Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Standard conforms config- and userdata-paths - Patch(es) to test
oBFusCATed:
Why do you think this will make a difference and make it less risky and error prone? ;D
dmoore:
Isn't a hand-rolled implementation as simple as:
--- Code: ---wxString XDGUserData()
{
wxString data_home;
if (wxGetEnv(wxT("XDG_DATA_HOME"), data_home))
return wxFileName(data_home, wxT("codeblocks")).GetFullPath();
else
return wxFileName(wxFileName::GetHomeDir(),wxT(".local/share/codeblocks")).GetFullPath();
}
wxString XDGUserConfig()
{
wxString config_home;
if (wxGetEnv(wxT("XDG_CONFIG_HOME"), config_home))
return wxFileName(config_home, wxT("codeblocks")).GetFullPath();
else
return wxFileName(wxFileName::GetHomeDir(),wxT(".config/codeblocks")).GetFullPath();
}
--- End code ---
Also, why in line 1475 of the unpatched code are we setting home_folder to the config dir?
--- Code: ---void ConfigManager::InitPaths()
{
ConfigManager::config_folder = ConfigManager::GetUserDataFolder();
ConfigManager::home_folder = wxStandardPathsBase::Get().GetUserConfigDir();
--- End code ---
What is home_folder supposed to mean? I guess it's not used anywhere but still...
Jenna:
--- Quote from: dmoore on February 01, 2015, 06:44:34 pm ---Also, why in line 1475 of the unpatched code are we setting home_folder to the config dir?
--- Code: ---void ConfigManager::InitPaths()
{
ConfigManager::config_folder = ConfigManager::GetUserDataFolder();
ConfigManager::home_folder = wxStandardPathsBase::Get().GetUserConfigDir();
--- End code ---
What is home_folder supposed to mean? I guess it's not used anywhere but still...
--- End quote ---
It's only used on windows in crashhandler.cpp in CrashHandlerSaveEditorFiles().
--- Quote from: oBFusCATed on February 01, 2015, 05:27:03 pm ---
--- Quote from: jens on February 01, 2015, 02:37:18 pm ---wxGTK already depends on glib, so it is not really a new dependency.
--- End quote ---
From the point of view of C::B it is abstracted away. If you want to go with the glib dependency, you'll have to change the spec file and probably the debian files.
--- End quote ---
Yes , I forgot these files. Even if it works, because glib2-devel is in the dependency-chain of wxGTK-devel (at least on Fedora), but this is , of course, not guaranteed.
oBFusCATed:
Just tried it on my home dev machine, where I have symlinks in the .codeblocks folder.
It seems that it copies them as is, thus if there are relative symlinks then they are invalid after the copy, absolute symlinks work are not broken.
So everything works as expected.
I have no hard links so I don't know what happens with them. 8)
The way to fix old version compatibility is to create two symlinks:
--- Code: ---ln -s ~/.config/codeblocks ~/.codeblocks
mkdir ~/.codeblocks/share
ln -s ~/.local/share/codeblocks ~/.codeblocks/share/codeblocks
--- End code ---
p.s. probably the dialog message should be changed to something more formal and to remove the 'I' from it:)
Jenna:
Hard links work (as far as I know they use the same inode and so they are neither relative or absolute), relative softlinks do not work.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version