6

In which directories should I place the following?
I have an application with few .net assemblies, a default database (containing default application settings), a directory with 100's of images, a directory for sounds (e.g. mp3's).

e.g.

somedir/myapp.exe  
somedir/myassembly1.dll  
somedir/myassembly2.dll  

somedir/images/1/image1.png  
somedir/images/1/image2.png  
somedir/images/2/image1.png  

somedir/sounds/1/sound1.mp3  
somedir/sounds/1/sound2.mp3  
somedir/sounds/2/sound1.mp3  

A requirement is that I want to allow my user to replace the sounds and images as they see fit so basically that path (e.g. /var or /usr) should typically have write access to a normal user.

2 Answers 2

5

If your application needs to be modifiable by a user, you should not be installing it to the system but have them do some kind of local-install to their user home folder. $HOME/yourapp/{bin,images,sounds} etc.

Most system paths like /var, /usr, are not and should not be write accessible by users.

The alternative is to install your app normally, but create a sort of overlay in $HOME/.yourapp that includes all the things the user has changed that are different from the system defaults.

1
  • 1
    +1 for the overlay approach. The application can look in $HOME first, and in the system path if the file isn't found. Commented May 10, 2011 at 12:30
2

You could follow the XDG Base Directory Specification and place the user-replacable stuff in a directory in $XDG_DATA_HOME and any user configuration files in a directory in $XDG_CONFIG_HOME (which default to $HOME/.local/share/ and $HOME/.config/ respectively).

I'm not sure this can be called the standard way of doing things yet but it's certainly popular, so your users will likely be familiar with it.

1
  • It's best IMO to combine XDG with the overlay idea mentioned by @Caleb. Commented May 17, 2017 at 4:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .