Jump to content
  • Advertisement
Sign in to follow this  
Zotoaster

Relative file directoties in Xcode?

This topic is 1722 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay so I'm using SDL and a .tmx parser to try and render some tilemaps from Tiled. I'm using Xcode with C++. So far so good.

 

But! The tilemaps' XML files refer to relative directories to find the tileset image. This is a problem because the compiled program is then looking relative to the build path rather than relative to the path of the tilemap.

 

TL;DR: Does anyone know how to access relative directories from the actual source code directories rather than the build directory?

 

Thanks

 

 

Edit: Of course "Directoties" should be "Directories". You get the picture

Edited by Zotoaster

Share this post


Link to post
Share on other sites
Advertisement

The natural way would be to let the build settings copy all resource files to where the running application expects them. The directory containing the source files is obviously something that is available at development stage only.

 

That said, you can set the working directory (where all relative paths besides those anchored in bundles) implicitly begin. For this purpose edit the scheme of our target, select its Run action, under the Info tab select the Debug (or Release) configuration, and under the Options tab check "Use custom working directory" and fill in the absolute path below the checkbox.

 

Alternatively / additionally you can pass startup parameters and environment variables (you know argc, argv, envp) by using the Arguments tab.

 

If you want to branch from the working directory you have to implement it yourself by either path concatenation or program controlled temporary modifications of the working directory.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!