Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to store resources for C++ program on linux

Tags:

c++

linux

This question says the best place to store settings in linux is in ~/.config/appname

The program I'm writing needs to use a 99MB .dat file for recognizing facial landmarks, embedding it in the binary doesn't seem like a good idea.

Is there some default place to store resources on linux? currently it's just in the directory next to the executable, but this requires that the program is run with the current directory being the directory it's located in.

What's the best way to deal with resources like this on linux? (that could potentially be cross platform with at least OSX)

like image 348
Jonathan. Avatar asked Jan 04 '16 20:01

Jonathan.


1 Answers

You should take a look at the Filesystem Hierarchy Standards. Depending on the data (will it change, is it constant across all installations, etc) the path where it gets placed will change based on the standards.

In general:

  • /usr/lib/program: includes object files, libraries, and internal binaries for an application
  • /usr/share/program: for all read-only architecture independent data files
  • /var/lib/program: holds state information pertaining to an application or the system

Those seem like pretty good places to start, and you can check the documentation to see if your app falls into one of those categories.

like image 105
Schiem Avatar answered Oct 23 '22 01:10

Schiem