Relative paths

Aug 30, 2010 at 7:50 PM


Gleed2D is a nice editor and I like its simplicity. There is one thing that bothers me, though. It always seems to use absolute paths for content items. I think that it makes it pretty much unusable for any serious projects. I want to be able to check out my projects from version control systems to any directory I like, on any computer, and have the code working.

So, I would like to have all the paths relative to the folder where the level file is located. For example, if there is a file levels\level1.xml in the project, texture paths should be something like ..\Content\textureOne.png.




This post/conversation was originally located at the old gleed2d forums and was moved here in September 2010 by the project coordinator, zissakos.

Aug 30, 2010 at 7:55 PM

Hi tkjantti,

the paths are actually stored as relative paths, just check the XML file. The only thing is, when loading a level the texture paths must somehow be complete (absolute) so the  editor knows where to search the textures. that's why the absolute path is built as a combination of the Level's ContentRootFolder plus the item's relative texture path. so if you want to use a level file on a different computer with a different folder structure, you actually only have to change one thing in the level XML file which is the COntentRootFolder.

This is actually done this way to enable the editor to be centrally located in any folder on the computer and being able to open levels from different projects with it.

Otherwise you would have to have multiple instances of the editor (one editor executable per game project) on your computer.