danni.coy Posted October 28, 2013 Posted October 28, 2013 It seems that xml.save() is saving relative to the application path rather than the data path and doesn't respect absolute paths. Why is this so? I almost always want to save stuff relative to the data path I can manually put in the ../data but this breaks when we use the double precision build. What is the best way to deal with this.
frustum Posted October 28, 2013 Posted October 28, 2013 There is no difference in Xml::save() internal code with other systems. It should work in same way as File class does. Can you describe the difference more precisely.
danni.coy Posted October 28, 2013 Author Posted October 28, 2013 Ok I have a piece of code that saves xml file xml.save(format("%s%s/tracks/flythroughts/%s.track",engine.getDataPath(),dirname(engine.world.getName()),trackname)); note that I have used engine.world.setName() in the world init function to set engine.world.getName() to the full path relative to data.This generates a file in bin/double_precisision/home/danni/Work/ai3drealtime-5.0/data/Levels/... a relative path eg xml.save(format("%s/tracks/flythroughs/%s.track",dirname(engine.world.getName(),trackname); also generates a file in bin/double_precision/Levels/... I have solved the problem using relname(engine.getAppPath(),engine.getDataPath()); but I was pretty sure that in other cases xml.save was behaving quite differently
Recommended Posts