On GNU / Linux systems, where should I download application data?

In this case, I use c with autoconf, but the question applies elsewhere.

I have a glade xml file that is required at runtime, and I have to tell the application where it is. I use autoconf to define a variable in my code that points to "specified prefix directory" / app -name / glade. But this is only starting to work after installing the application. What if I want to run the program before? Is there a standard way to determine how to verify application data?

thanks


Thanks for answers. To clarify, I do not need to know where the application data is installed (for example, by searching in / usr, usr / local, etc. etc.), This is done by the configure script. The problem was determining whether the application was installed yet. I’ll probably do the installation first at the installation location, and if not at ./src/foo.glade.

+3
source share
4 answers

I do not think there is a standard way to define such data.

, , , - , DATADIR + APPNAME, autoconf CURRENTDIRECTORY + POSSIBLE_PREFIX, .

autoconf , (, deb/rpm)

+2

, , Debian - /usr/share,/usr/lib .. , . Debian .

, . -, ; , fopen(). , , :

  • ()
  • ~/.program-name
  • $(datadir)/program-name

$(datadir) - , Makefile.am. :

AM_CPPFLAGS = $(ASSERT_FLAGS) $(DEBUG_FLAGS) $(SDLGFX_FLAGS) $(OPENGL_FLAGS) -DDESTDIRS=\"$(prefix):$(datadir)/:$(datadir)/program-name/\"

, , configure configure.ac.

, , dirs. - PATH, .

, , . Makefile.am $(datadir) util.cpp util.h (yatc_fopen()). yatc_find_file(), - fopen() ing, SDL_image libxml2.

+1

​​:

/usr/share/app-name/glade.xml

, (.. ), .

0

, . , .

, .

, glade.xml , . /etc,/usr/share/app-name,/usr/local/etc.

, , . , . ~/.glade.xml ~/.app-name/glade.xml ~/.app-name/.glade.xml.

0
source

Source: https://habr.com/ru/post/1710027/


All Articles