Re: [Kicad-developers] KICAD_CACHE_HOME environment variable

2018-06-01 Thread Wayne Stambaugh
On 05/30/2018 05:28 PM, Nick Østergaard wrote:
> It looks like it works as intended, but I don't think the naming is that
> good. Maybe it might be better to call it KICAD_RUNTIME_DIR analogous to
> XDG terminology used elsewhere and nearby...
> 
> If it is called KICAD_CACHE_HOME one would think that this would control
> the location of the 3d cache too, which is really inside the config dir.
> 
> So if is renamed to KICAD_RUNTIME_DIR might be better. But it is a bit
> strange that XDG_CACHE_HOME is caught in the lockfile management too.

KICAD_CACHE_HOME seems consistent with XDG_CACHE_HOME for lock files.  I
don't have a strong preference but for users familiar with XDG
environment variables, it may be more consistent than user
KICAD_RUNTIME_DIR.

> 
> 2018-05-14 23:39 GMT+02:00 Mike Wodarczyk  >:
> 
> On 08.05.2018 02:57, Mike Wodarczyk wrote:
> 
> Attached is a patch to use a new KICAD_CACHE_HOME environment
> variable to set a custom path for the lockfiles on all
> platforms. It's tested under Windows and works as expected.
> 
> Oops attached the wrong file. This is the compiling patch. Sorry for
> the inconvience :-)
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> 
> Post to     : kicad-developers@lists.launchpad.net
> 
> Unsubscribe : https://launchpad.net/~kicad-developers
> 
> More help   : https://help.launchpad.net/ListHelp
> 
> 
> 
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] KICAD_CACHE_HOME environment variable

2018-05-30 Thread Nick Østergaard
It looks like it works as intended, but I don't think the naming is that
good. Maybe it might be better to call it KICAD_RUNTIME_DIR analogous to
XDG terminology used elsewhere and nearby...

If it is called KICAD_CACHE_HOME one would think that this would control
the location of the 3d cache too, which is really inside the config dir.

So if is renamed to KICAD_RUNTIME_DIR might be better. But it is a bit
strange that XDG_CACHE_HOME is caught in the lockfile management too.

2018-05-14 23:39 GMT+02:00 Mike Wodarczyk :

> On 08.05.2018 02:57, Mike Wodarczyk wrote:
>
>> Attached is a patch to use a new KICAD_CACHE_HOME environment variable to
>> set a custom path for the lockfiles on all platforms. It's tested under
>> Windows and works as expected.
>>
>> Oops attached the wrong file. This is the compiling patch. Sorry for the
> inconvience :-)
>
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] KICAD_CACHE_HOME environment variable

2018-05-14 Thread Mike Wodarczyk

On 08.05.2018 02:57, Mike Wodarczyk wrote:
Attached is a patch to use a new KICAD_CACHE_HOME environment variable 
to set a custom path for the lockfiles on all platforms. It's tested 
under Windows and works as expected.


Oops attached the wrong file. This is the compiling patch. Sorry for the 
inconvience :-)


From 3d05a27d00453c608031efec702ca8f898e0a584 Mon Sep 17 00:00:00 2001
From: mwayne 
Date: Wed, 9 May 2018 02:27:25 +0200
Subject: [PATCH] Make lockfile path adjustable.

Use KICAD_CACHE_HOME environment variable on all platforms so users can specify 
a custom cache path.
---
 common/lockfile.cpp | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/common/lockfile.cpp b/common/lockfile.cpp
index 92ee0bd..2df4475 100644
--- a/common/lockfile.cpp
+++ b/common/lockfile.cpp
@@ -61,13 +61,13 @@ wxString GetKicadLockFilePath()
 wxFileName lockpath;
 lockpath.AssignDir( wxGetHomeDir() ); // Default wx behavior
 
+wxString envstr;
 #if defined( __WXMAC__ )
 // In OSX use the standard per user cache directory
 lockpath.AppendDir( "Library" );
 lockpath.AppendDir( "Caches" );
 lockpath.AppendDir( "kicad" );
 #elif defined( __UNIX__ )
-wxString envstr;
 // Try first the standard XDG_RUNTIME_DIR, falling back to XDG_CACHE_HOME
 if( wxGetEnv( "XDG_RUNTIME_DIR",  ) && !envstr.IsEmpty() )
 {
@@ -86,12 +86,18 @@ wxString GetKicadLockFilePath()
 lockpath.AppendDir( "kicad" );
 #endif
 
-#if defined( __WXMAC__ ) || defined( __UNIX__ )
+// Use KICAD_CACHE_HOME to allow the user to force a specific cache path.
+if( wxGetEnv( wxT( "KICAD_CACHE_HOME" ),  ) && !envstr.IsEmpty() )
+{
+// Override the assignment above with KICAD_CACHE_HOME
+lockpath.AssignDir( envstr );
+}
+
 if( !lockpath.DirExists() )
 {
 // Lockfiles should be only readable by the user
 lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL );
 }
-#endif
+
 return lockpath.GetPath();
 }
-- 
2.7.2.windows.1

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] KICAD_CACHE_HOME environment variable

2018-05-07 Thread Mike Wodarczyk
Attached is a patch to use a new KICAD_CACHE_HOME environment variable 
to set a custom path for the lockfiles on all platforms. It's tested 
under Windows and works as expected.


From 7f4245b0e2eacdeaa01d5cd753de5dfdcd28360c Mon Sep 17 00:00:00 2001
From: mwayne 
Date: Mon, 7 May 2018 13:46:33 +0200
Subject: [PATCH] Make lockfile path adjustable.

Use KICAD_CACHE_HOME environment variable on all platforms so users can specify 
a custom cache path.
---
 common/lockfile.cpp | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/lockfile.cpp b/common/lockfile.cpp
index 92ee0bd..baae3eb 100644
--- a/common/lockfile.cpp
+++ b/common/lockfile.cpp
@@ -86,12 +86,18 @@ wxString GetKicadLockFilePath()
 lockpath.AppendDir( "kicad" );
 #endif
 
-#if defined( __WXMAC__ ) || defined( __UNIX__ )
+// Use KICAD_CACHE_HOME to allow the user to force a specific cache path.
+if( wxGetEnv( wxT( "KICAD_CACHE_HOME" ),  ) && !envstr.IsEmpty() )
+{
+// Override the assignment above with KICAD_CACHE_HOME
+lockpath.AssignDir( envstr );
+}
+
 if( !lockpath.DirExists() )
 {
 // Lockfiles should be only readable by the user
 lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL );
 }
-#endif
+
 return lockpath.GetPath();
 }
-- 
2.11.1.windows.1

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp