|
|
Home » Developing U++ » U++ Developers corner » Things we want from Linux/FreeBSD release archives
|
|
|
|
|
|
Re: Things we want from Linux/FreeBSD release archives [message #53477 is a reply to message #53475] |
Sun, 05 April 2020 13:07 |
|
mirek
Messages: 14038 Registered: November 2005
|
Ultimate Member |
|
|
amrein wrote on Sun, 05 April 2020 11:46Hi
I don't understand why we use ~/.config and ~/.cache and not directories in the current source directory when U++ is inside user home directory.
I mean, the main idea of sandboxing is to keep everything in the same directory, right?
You have missed the description of the process. It is quite more complicated then just using ~/.config / ~.cache.
String ConfigFile(const char *file) {
if(sConfigFolder.GetCount())
return AppendFileName(sConfigFolder, file);
#if defined(PLATFORM_WIN32)
if(sHomecfg) {
String p = GetHomeDirFile(GetAppName());
ONCELOCK
RealizeDirectory(p);
return AppendFileName(p, file);
}
return GetExeDirFile(file);
#elif defined(PLATFORM_POSIX)
static String cfgdir;
ONCELOCK {
String h = GetExeFolder();
if(!sHomecfg)
while(h.GetCount() > 1 && DirectoryExists(h)) {
String pp = AppendFileName(h, ".config");
FindFile ff(pp);
if(ff && ff.IsFolder() && ff.CanWrite()) {
cfgdir = pp;
break;
}
h = GetFileFolder(h);
}
if(IsNull(cfgdir))
cfgdir = GetEnv("XDG_CONFIG_HOME");
if(IsNull(cfgdir) || !DirectoryExists(cfgdir))
cfgdir = GetHomeDirFile(".config");
if(sConfigGroup.GetCount())
cfgdir = AppendFileName(cfgdir, sConfigGroup);
}
String pp = AppendFileName(cfgdir, GetAppName());
RealizeDirectory(pp);
return AppendFileName(pp, file);
#else
NEVER();
return GetExeDirFile(file);
#endif//PLATFORM
}
|
|
|
|
Re: Things we want from Linux/FreeBSD release archives [message #53481 is a reply to message #53478] |
Sun, 05 April 2020 13:22 |
|
mirek wrote on Sun, 05 April 2020 13:10Zbych wrote on Sun, 05 April 2020 11:12Novo wrote on Sun, 05 April 2020 00:49This does affect Mac and Linux apps.
What is technical reason of this change?
To be honest I pissed off by changes like this. I have many embedded apps that keep their settings in .upp directory and the last thing I need is to loose their settings, because default ConfigFile() has changed.
Thinking about it... I can actually change ConfigFile further so that it will use ~/.upp config if it finds it instead of ~/.config.
Do we want that?
Mirek
Well, it would solve the backwards compatibility issue, quite smoothly. Only new apps or new installations of existing apps would start to use the old directory. Possible alternative would be to make the code migrate the files from ~/.upp to ~/.config, but that seems quite invasive and could result in some broken apps, e.g. when both new and older version would be run on same machine.
Honza
|
|
|
|
|
|
Re: Things we want from Linux/FreeBSD release archives [message #53506 is a reply to message #53501] |
Tue, 07 April 2020 05:34 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
Another problem with Mac.
It looks like GetExeFolder() doesn't resolve links on Mac.
The way I check that: I created a link to umk in ~/.local/bin
~/.local/bin/umk -> ~/dvlp/cpp/upp/out/uppsrc/CLANG.Blitz.Shared/umk
Config dir is located in ~/dvlp/cpp/upp/
This perfectly works on Linux but Mac.
On Mac I need to create a link to config dir in ~/.local/
I guess the problem is with GetExeFolder() -> GetExeFilePath() ...
Not sure who is supposed to resolve links, OS or Upp ...
Debugger doesn't work on Mac, so, it is a little bit difficult to track an origin of the problem.
Regards,
Novo
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 04:17:12 CEST 2024
Total time taken to generate the page: 0.03387 seconds
|
|
|