Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » [solved!] XML serialization and relative paths
[solved!] XML serialization and relative paths [message #19028] Thu, 06 November 2008 13:48 Go to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Recently I used StoreAsXMLFile/LoadFromXMLFile on POSIX system with latest build. And discovered no xml file in my executable`s directory. Finally discovered it is situated in ~/.upp/<exe_name>/<exe_name>.xml
This is really good default behaviour. But when I define filename with relative path, it is still situated in ~/.upp/<exe_name> directory! This is the surprise I want to talk about.

The problem is that I have a number of the same executables (in a number of directories) which should hold different configurations for each of them. But it can`t be done with standard functions as all the XML config files are overwritten within one directory.

I dag into U++ and discovered that IsFullPath() is called, which is false even for files like "./setup.conf". Yes, it is not a full path, but it is exactly the path I want. And function must work with this file with no surprises.

My proposal is to rename these functions to StoreAsXMLFileDefault/LoadFromXMLFileDefault and add StoreAsXMLFile/LoadFromXMLFile functions with no surprises in their behaviour.

[Updated on: Thu, 06 November 2008 22:24]

Report message to a moderator

Re: XML serialization and relative paths [message #19035 is a reply to message #19028] Thu, 06 November 2008 21:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, I am not sure who implemented sXMLFile and what he was thinking (but I am afraid it was me Smile.

In any case, IMO, there is no need to rename - let us just fix that stupid idea:

static String sXMLFile(const char *file)
{
    return file ? String(file) : ConfigFile(GetExeTitle() + ".xml");
/*    if(file)
        return IsFullPath(file) ? String(file) : ConfigFile(file);
    else
        return ConfigFile(GetExeTitle() + ".xml");*/
}


Mirek
Re: XML serialization and relative paths [message #19037 is a reply to message #19035] Thu, 06 November 2008 22:23 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Smile Thanks!
Previous Topic: (Possible) Serialization issue
Next Topic: Win 98
Goto Forum:
  


Current Time: Sat Apr 20 09:20:56 CEST 2024

Total time taken to generate the page: 0.69483 seconds