aMule Forum
English => Feature requests => Topic started by: linuxfever on August 01, 2007, 10:24:31 PM
-
I wish to set up where configuration is stored. Currently it`s in documents and settings folder. I would change it to ./ to make it work on usb harddisks too.
-
Then modify aMule source code, and recompile it. Or try eMule.
Regards.
-
Well, we COULD do that. If anyone wants to code a preferences option for "use local config on execution folder" or similar.
-
How do you think about a check for a local (writeable) config folder on startup to determine the location?
-
Naaaah. Only check first for a config in the folder where it's executed, and if it's not there, then the standard ones.
-
OK, that's what I meant. Breaking the startup code would be a new experience for me anyway...;)
http://bugs.amule.org/view.php?id=1155
-
Naaaah. Only check first for a config in the folder where it's executed, and if it's not there, then the standard ones.
Maybe check it in the reverse order? that way a user could override global configuration with a configuration in his $HOME folder.
Regards.
-
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();
}
-
I implemented this feature now.
aMule will look for a configuration in ./config and will only use it if there's a file amule.conf in the config folder. An example:
This is your portable aMule directory structure:
./bin
./config
./temp
./incoming
When you start aMule with ./bin/amule and it will search for ./config/amule.conf, not ./bin/config/amule.conf i.e. the config directory is relative to the current working directory, not to the aMule executable.
I'm not sure whether relative paths are allowed for Temp and Incoming folders, this might have to be adjusted by an startup script.
Now: Anyone out there interested in creating a Portable aMule package? All you should need is a static aMule binary and a little startup script. Please contact me if there are any other lookup paths which have to be adjusted.