Re: [Amis-vcs] SF.net SVN: amis: [2238] branches/amis3
Brought to you by:
julienq,
marisademeglio
From: Jack J. <Jac...@cw...> - 2007-12-04 12:39:07
|
On 3 dec 2007, at 15:25, dan...@us... wrote: > Revision: 2238 > http://amis.svn.sourceforge.net/amis/?rev=2238&view=rev > Author: daniel_weck > Date: 2007-12-03 06:25:28 -0800 (Mon, 03 Dec 2007) > > Log Message: > ----------- > - Daniel WECK > * Fixed nasty bug where space character is escaped in URL syntax > (%20). This is a hacky workaround that needs to be looked at ... > Modified: branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp > =================================================================== > --- branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp > 2007-12-03 12:35:37 UTC (rev 2237) > +++ branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp > 2007-12-03 14:25:28 UTC (rev 2238) > @@ -102,7 +102,16 @@ > { > if (id.compare("ui-lang") == 0) > { > - mpPrefs->mUiLangDir = > amis::util::FilePathTools::goRelativePath(mpPrefs- > >mSourceUrl.get_url(), value); > + string strFileName = mpPrefs->mSourceUrl.get_url(); > + > + // TODO: This is a hacky workaround ! We need to globally make > sure that URL syntax with escape characters is supported ! > + int pos = strFileName.find("%20"); > + while (pos != string::npos) { > + strFileName = strFileName.replace(pos, 3, " "); > + pos = strFileName.find("%20"); > + } > + > + mpPrefs->mUiLangDir = > amis::util::FilePathTools::goRelativePath(strFileName, value); > } get_url() is the wrong call here. You should use is_local_file() to test whether the URL indeed refers to a local file and then get_file() to retrieve the filename. This will take care not only of %-escaping but also /-to-\ conversion, disk specs, etc. The intention is that ambulant::net::url provides everything to treat URLs as first class citizens. In other words, if you ever have to muck with the strings that come out of ambulant::net::url that should be considered a bug, and if you let me know I'll fix it. -- Jack Jansen, <Jac...@cw...>, http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman |