aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: portable on windows  (Read 4071 times)

linuxfever

  • Disabled account (bugmenot)
  • Approved Newbie
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 48
portable on windows
« 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.
Logged

skolnick

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 24
  • Offline Offline
  • Posts: 1188
  • CentOS 6 User
Re: portable on windows
« Reply #1 on: August 02, 2007, 02:35:58 AM »

Then modify aMule source code, and recompile it. Or try eMule.

Regards.
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: portable on windows
« Reply #2 on: August 02, 2007, 03:20:17 AM »

Well, we COULD do that. If anyone wants to code a preferences option for "use local config on execution folder" or similar.
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: portable on windows
« Reply #3 on: August 02, 2007, 08:40:52 AM »

How do you think about a check for a local (writeable) config folder on startup to determine the location?
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: portable on windows
« Reply #4 on: August 02, 2007, 04:40:26 PM »

Naaaah. Only check first for a config in the folder where it's executed, and if it's not there, then the standard ones.
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: portable on windows
« Reply #5 on: August 02, 2007, 06:09:03 PM »

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
Logged

skolnick

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 24
  • Offline Offline
  • Posts: 1188
  • CentOS 6 User
Re: portable on windows
« Reply #6 on: August 03, 2007, 03:51:34 AM »

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.
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: portable on windows
« Reply #7 on: August 03, 2007, 08:31:24 AM »

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:
Code: [Select]
--- 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();
 }
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: portable on windows
« Reply #8 on: October 12, 2007, 01:19:12 PM »

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:
Code: [Select]
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.
Logged