Help with data directories

This is a discussion on Help with data directories within the Linux Programming forums, part of the Platform Specific Boards category; I know this probably has nothing to do with the actual code itself, but how do I find out where ...

  1. #1
    Linux User
    Join Date
    Nov 2005
    Location
    Bellingham, WA
    Posts
    35

    Help with data directories

    I know this probably has nothing to do with the actual code itself, but how do I find out where the directory the user compiled the program in is? I am using kdevelop as my IDE and I am running Mandriva 10.1. Supertux did a nice job of this but I can't figure how they did it.
    "Just as eating contrary to the inclination is injurious to the health,
    so study without desire spoils the memory, and it retains nothing that it takes in."


    - Leonardo De Vinci (1452-1519)

  2. #2
    xhi
    xhi is offline
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    >> how do I find out where the directory the user compiled the program in is?
    so you just want to know how to find the current projects path. or are you looking for where kdevelop was built at.. im not quite clear on what program you are referring to..

    if it is the current project then you should have a sidebar with a 'file selector' on it, it should have the path listed in there..

  3. #3
    Linux User
    Join Date
    Nov 2005
    Location
    Bellingham, WA
    Posts
    35

    To be more specific

    When you compile the program that you've writen, I believe there is some way you can define datadir(the directory of the data source) in the config.h file that the configure script generates. But I am not sure how to do so with kdevelop. Does anybody know how to do this using kdevelop?
    "Just as eating contrary to the inclination is injurious to the health,
    so study without desire spoils the memory, and it retains nothing that it takes in."


    - Leonardo De Vinci (1452-1519)

  4. #4
    xhi
    xhi is offline
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    you can set configure vars in 'project'->'project options', under the 'configure options' section.. just pass --datadir=DIR as usual..

    is this what you are looking for?

  5. #5
    Linux User
    Join Date
    Nov 2005
    Location
    Bellingham, WA
    Posts
    35

    Kind of

    This is sort of what I'm looking for however when I did so and ran ./configure then make it came back with the output saying that -fdatadir=DIR is an unrecognized command, but when I looked at the commands that it had executed it had executed the command --datadir=DIR. Do I need to replace the DIR with something?
    "Just as eating contrary to the inclination is injurious to the health,
    so study without desire spoils the memory, and it retains nothing that it takes in."


    - Leonardo De Vinci (1452-1519)

  6. #6
    xhi
    xhi is offline
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    yes DIR is representing the directory path you want to use..

    ex..

    --datadir=/your/path/to/the/data-dir/
    Last edited by xhi; 01-31-2006 at 07:37 AM. Reason: data-dir --> datadir

  7. #7
    Linux User
    Join Date
    Nov 2005
    Location
    Bellingham, WA
    Posts
    35

    I probably need to be a little more explanatory.

    OK I can see what your saying there but what if someone else on a nother machine is compiling this program. How then do I tell the program to find out where they compiled the program at? If you are wondering what I am talking about visit supertux.berlios.de and go the downloads section and download the source code release version 1.1.3 and compile it then when you execute the game it will say datadir=/where/you/compiled/supertux/at/data. This is what I am trying to achieve.
    "Just as eating contrary to the inclination is injurious to the health,
    so study without desire spoils the memory, and it retains nothing that it takes in."


    - Leonardo De Vinci (1452-1519)

  8. #8
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    Mostly, this is achieved by using make and a makefile.

    If you actually download that package, and look at the makefile, you should see it get the current directory, and pass this as say a -DHERE=/path/to/here command line option to the compiler.

  9. #9
    xhi
    xhi is offline
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    does the game have a config file.. or does it accept a cmd line arg for datadir? if so just enter in the path for the datadir.. i doubt this was meant to be an option that was setup at compile time.. more than likely you could copy that datadir from the source dir to /usr/local/share (or where ever).. and then change a config file to say
    datadir=/usr/local/share/tux/data

    imo, hardly a compile time problem..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. xor linked list
    By adramalech in forum C Programming
    Replies: 23
    Last Post: 10-14-2008, 10:13 AM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  4. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  5. Replies: 1
    Last Post: 07-31-2002, 11:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21