Location of user's profile/settings

  • Nobody/Anonymous


    I have built moreamp but it seems that the user's profile/settings (e. g. masonglists, masettings and mafileout directories) are created in the same directory as the executable. In Linux, it causes permission problems since executables are usually installed in system directories. Would it be possible for moreamp to install these files in the user's home directory? I tried patching the code without success.

    Thanks for your help,

    • Nobody/Anonymous

      Eric wrote :
      ... Would it be possible for moreamp to install these (settings) files in the user's home directory? ...

      Yes, this will be done in the next moreamp release (0.1.12), except that these files will go into the unix current working dir (cwd), which may or may not be the user's home dir, so that we can still run multiple instances of moreamp by running each instance in a different dir (each instance wants its own settings).

      In the meantime, you can try this :

      In the user's home dir, or wherever you want the settings files, make a link to the moreamp executable, e.g. assuming you want the setings in /users/homedir and moreamp is installed in /usr/lobal/bin :

      cd /users/homedir
      ln -s /usr/local/bin/moreamp malink

      Then enter './malink', or '/users/homedir/malink', instead of 'moreamp'. The settings files will go into /users/homedir.

      On unix Moreamp extracts a path for the settings files from the command line argv[0]. I don't know what happens if you double-click on malink on a desktop. You can use the 'Open Song List' menu to see where moreamp puts masonglists and the other settings files.

      If you prefer to patch moreamp, try one of these two patches :

      in maApp.cpp (0.1.11) change lines 902-907

      ------ from :

      if defined(MAUNIX)

      // on unix wxGetCwd() doesn't seem to
      wxFileName f(g_theApp->argv[0]);
      strcpy(g_homedir, f.GetPath(wxPATH_GET_VOLUME).c_str());


      ------ (1) to :

      if defined(MAUNIX)

      // this sets g_homedir to the cwd
      if (!getcwd(g_homedir, (size_t)MAX_PATH))
                  char cstr[64];
                  sprintf(cstr, "OnInit getcwd errno=%d, cannot continue", errno);
                  return FALSE;


      ------ or (2) to :

      if defined(MAUNIX)

      // this sets g_homedir to the user's home dir
      char *p;
      if ((p = getenv("HOME")))
          strcpy(g_homedir, p);
          ShowErr("OnInit getenv(HOME) failed, cannot continue");
          return FALSE;


      For patch 2, also add under line 47
      #include <stdlib.h>

      The first patch will be in release 0.1.12.

      The second patch may be a configure option if someone asks for it. It precludes running multiple instances of moreamp (except by multiple users with different home dirs).

      About the comment in 0.1.11 '// on unix wxGetCwd() doesn't seem to' : actually wxGetCwd() does get the cwd, but I was expecting 'Cwd' to be the same as on os9, i.e. the dir holding the executable.


    • Nobody/Anonymous

      Thanks for your quick answer. I used patch (2) and it worked perfectly. I have built a package for Arch Linux.

      Here's a suggestion to handle multiple instance of moreamp (I don't know how difficult it would be to implement): It would be better, in my point of view, to have an option in moreamp's settings menu where the user can choose whether he wants moreamp to allow multiple instance of itself.

      The multiple instance of moreamp could use the same directories where each instance would have it's own files (eg. ~/masettings/setting1 ~/masettings/setting2, etc.).



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks