I've written the code for Kry's variant (not commited+breaks coding standards) and current behaviour really surprised me.
I compiled it, created a 'config' dir in the current working directory and on startup aMule copied all files from ~/.aMule to this directory, because there was no amule.conf. Unintentionally I found a method to automatically convert a user config to a local config.
The downside? Have a 'config' folder in ~ (=cwd) and you might not even realize that aMule just converted to a new configuration directory. Even though this could be solved by a message, I have currently no way to suppress this behaviour if the user doesn't want to use ~/config , but needs this directory for whatever reason.
For those who want to play with it:
--- src/OtherFunctions.cpp (revision 7364)
+++ src/OtherFunctions.cpp (working copy)
@@ -1154,6 +1154,14 @@
wxString GetConfigDir()
{
+ wxString directory = wxGetCwd() + wxFileName::GetPathSeparator() + wxT("config") + wxFileName::GetPathSeparator();
+ if (wxDirExists(directory)) {
+ printf("Found local 'config' directory.\n");
+ if (not wxAccess(directory, R_OK | W_OK | X_OK)) {
+ return directory;
+ }
+ printf("Insufficient permissions on 'config', using user configuration folder.\n");
+ }
return GetUserDataDir() + wxFileName::GetPathSeparator();
}