kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #35545
XDG_CONFIG_HOME on all platforms
-
To:
KiCad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
Wayne Stambaugh <stambaughw@xxxxxxxxx>
-
Date:
Mon, 23 Apr 2018 13:10:58 -0400
-
Autocrypt:
addr=stambaughw@xxxxxxxxx; prefer-encrypt=mutual; keydata= xsDiBEM0hxQRBAC2fNh3YOVLu1d5GZ0SbrTNldGiGnCJPLqzEnqFX9v6jmf33TMt6EmSLkl6 Wtfkoj0nVwKxcYmJkA8DX0QAokBkwNIzhSsBzQvthBLIk/5LnPVVKrEXOcL4mUyH1doKlkaE slgJozNa6Av+oavcvD02o1zJOloBbaHlNlyRt7fKswCgtIFlVjWggVH/15KfWk+Qo5JVPbME AIUBAQyL2OAx0n60AWec2WHnO9buHuG0ibtICgUMkE+2MRmYyKwYRdyVwGoIUemFuOyHp0AJ InX4T+vy2E7vkwODqjtMLfIoRkokW74Fi4nrvjlhOAw/vdq/twLbAmR9MOfPTpR4y7kQy1O2 /n+RkkRvh26vTzfbQmrH7cBJhk6aA/9Uwvu3E4zNJgHVZeS0HyWtmR1eOPPRbnkPgJTToX5O KMKzTJI/FX6kT7cFoCamitHrW3BJP4Dx+cMMsa47EGxqVTdbVJ4LjogsXTXxb+0Fn1u4zBdx x3Cer6O7+hqWy7zvpzeC6nSREjqDKa5CgHtv/GLm5uFPOmsjAsnHj2tlBs0mV2F5bmUgU3Rh bWJhdWdoIDxzdGFtYmF1Z2h3QGdtYWlsLmNvbT7CYgQTEQIAIgUCWXDoogIbAwYLCQgHAwIG FQgCCQoLBBYCAwECHgECF4AACgkQG1FxaVn4JF5QbACgmUn1LehNSvH8BMlCRmApskCt8sgA nAw4GoFvw6bm3b7w/Tv4cwapzwPAzsFNBEM0hzEQCACAKu77f9o4LpEKOm9gLvbBj53lKYem ELrJ6JXb+Y66bK3kwuj8+zYbOdmvXUmymoWTkr9mm+kwwuqqMNnf37nRraIpFAUno2Ur6ElY yaPp4nKBCsLBijcaNzoKp+upS/7xVKd/+Lmwhma05UDhmMwvXwy4G8xKw11UsUl3kc2dhvWI 4QKm+p09WH/bUssITDsxRQYaccGEKuaTZol7mEWZxI2DiV0FxeuAxAHB/toxWihtcEwUNv8g Q0HJefSWUHsavYgUxGY1L3+nyz8gjViXZtOrJfgVLPxx+fsL0oTPt9pnvDMBynAcUL/Ozcmg CMnQgQp01SkjACUozNPcLNy3AAMFB/9zGkbbwwrKuqSc2ar/wtAvL7HoVJhcEuPFDP0GIE1h 56wNlDonlRsvWaOknMxrm0tnKk9ijhtsbJHbaGtvIMUruboBxVowgkqX3yDi6Qy60V8AnJEN pEQflmX9fU/i7Vn/JoAjL2Ypo1torX/l2M0nnAJMV6dNSACn3F1zfSQaQUN0skWnm7ENjg/S 9pmJl2NQK8MzdmO/kjOk05/FWpNQFA1Q/8GecqGSTSkNMPqzdfxL4PSs60QFDwrRzAREj8Tw QVryePRM3Dh7YxgZHzCD5LGonvPl/TM9jRs7ob0MMUHBgKrPM9Yap0CH28Dn3vVMBs8RG10X JuGS6ujOnZJ9wkkEGBECAAkFAkM0hzECGwwACgkQG1FxaVn4JF6wdQCfSqokQS6ftWlwGN/e +uSvJR4wcrkAn1gPSGRloW9a9w+p6ugM6pNfNNpx
-
Openpgp:
preference=signencrypt
-
User-agent:
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
Attached is a patch that allows users to have multiple configuration
paths using the XDG_CONFIG_HOME environment variable on all platforms.
I tested it on windows and it seems to work just fine. I can test it on
linux tonight when I get home but if someone can get to it before then I
would appreciate the help. Would one of our macos devs please test it
as well before I merge it.
Thanks,
Wayne
From 9aa94dd0880adc5a61ffb8426ab84255411249e4 Mon Sep 17 00:00:00 2001
From: Wayne Stambaugh <stambaughw@xxxxxxxxx>
Date: Mon, 23 Apr 2018 10:29:03 -0400
Subject: [PATCH] Allow for multiple user configurations.
Use XDG_CONFIG_HOME environment variable on all platforms so users can
maintain multiple configurations of KiCad.
---
common/common.cpp | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/common/common.cpp b/common/common.cpp
index f5b8abce4..947e3f8be 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -219,28 +219,25 @@ wxString GetKicadConfigPath()
{
wxFileName cfgpath;
- // From the wxWidgets wxStandardPaths::GetUserConfigDir() help:
- // Unix: ~ (the home directory)
- // Windows: "C:\Documents and Settings\username\Application Data"
- // Mac: ~/Library/Preferences
+ // http://docs.wxwidgets.org/3.0/classwx_standard_paths.html#a7c7cf595d94d29147360d031647476b0
cfgpath.AssignDir( wxStandardPaths::Get().GetUserConfigDir() );
+ // wxStandardPaths does not default to ~/.config which is the current standard config
+ // location on Linux.
#if !defined( __WINDOWS__ ) && !defined( __WXMAC__ )
+ cfgpath.AppendDir( wxT( ".config" ) );
+#endif
+
+ cfgpath.AppendDir( wxT( "kicad" ) );
+
wxString envstr;
- if( !wxGetEnv( wxT( "XDG_CONFIG_HOME" ), &envstr ) || envstr.IsEmpty() )
- {
- // XDG_CONFIG_HOME is not set, so use the fallback
- cfgpath.AppendDir( wxT( ".config" ) );
- }
- else
+ // Use XDG_CONFIG_HOME on all platforms to allow for multiple configurations.
+ if( wxGetEnv( wxT( "XDG_CONFIG_HOME" ), &envstr ) && !envstr.IsEmpty() )
{
// Override the assignment above with XDG_CONFIG_HOME
cfgpath.AssignDir( envstr );
}
-#endif
-
- cfgpath.AppendDir( wxT( "kicad" ) );
if( !cfgpath.DirExists() )
{
--
2.17.0
Follow ups