Results 1 to 4 of 4

Thread: Relative File Path

  1. #1

    Default Relative File Path

    Hi, thanks for a great library. However, I've stumbled upon a (stupid) problem: What I want to do is have a relative file path, ie. so that I can do this:

    CL_ResourceManager("tiles/fun.xml");
    CL_ResourceManager("objects/fun.xml");
    ...

    But for some reason, this doesn't seem to work very well. It seems like CL is changing some internal variables, meaning the second calls acts more like:

    CL_ResourceManager("tiles/objects/fun.xml");

    Which is not exactly what I want. I'd also like CL_FileDialog to act this way, ie. returning the relative path.

    Is there any easy way to do this, or do I have to work around it somehow?

    BTW, I'm using ClanLib 0.8 SVN.

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I use ClanLib 0.9 SVN, but try this anyway

    CL_ResourceManager("./tiles/fun.xml");
    CL_ResourceManager("./objects/fun.xml");

    Have a look at Examples/GUIDesk/guideck.cpp...,
    CL_ResourceManager resources("../../Resources/GUIStyleSilver/gui.xml");
    CL_ResourceManager extra_resources("guistuff.xml");
    resources.add_resources(extra_resources);

  3. #3

    Default

    I'm sorry. It seems like CL_FileDialog is the one changing the relative directory. A call to:

    CL_Directory::get_current() + CL_FileDialog::open()

    ... seems to return the correct absolute path, but is there a way to make CL_FileDialog return a path relative to the folder it was opened, and not have it change the current directory?
    Last edited by Seth; 03-08-2008 at 12:59 AM. Reason: (disabled smilies so the code would show right)

  4. #4
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    I remember also noticing some oddness with how CL_FileDialog handles the directories... I think I worked around it by storing the current directory to a temp var, using CL_FileDialog, then setting the current dir from the temp var again.

    Not sure if I'll get around to fixing it but feel free to send a patch if you do!
    Seth A. Robinson
    Robinson Technologies

Similar Threads

  1. write to XML file
    By DavinciZhe in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 01-20-2008, 12:21 PM
  2. State of the configure.ac file
    By rombust in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-09-2007, 01:11 PM
  3. jjohn's welcome2.swf file
    By File Sponge in forum Funeral Quest
    Replies: 6
    Last Post: 11-13-2006, 07:54 AM
  4. Clean dink.ini file!
    By Davidi in forum Dink Smallwood HD
    Replies: 0
    Last Post: 07-09-2004, 10:24 AM
  5. Clean dink.ini file!
    By Davidi in forum Dink Smallwood HD
    Replies: 0
    Last Post: 07-09-2004, 10:23 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •