Kobus Grobler
2014-04-11 07:20:13 UTC
Hi
OS: Windows (and other I would think)
wx Version: wxWidgets 3.0
There seems to be an issue with the way wxArchiveFSHandler (and
wxFileSystemHandler) handles a # in the path provided to it.
Let's say you have a zip file in a folder with a # in it, like so:
C:/work/test#1/data.zip
The url to open a file "test.txt" in the archive would be:
file:C:/work/test#1/data.zip#zip:test.txt
Then wxArchiveFSHandler will not find the file data.zip because of the #
earlier in the path.
The problem is when wxArchiveFSHandler uses wxFileSystemHandler to open
the file because wxFileSystemHandler::GetRightLocation()
returns "C:/work/test" instead of "C:/work/test#1/data.zip" due to the #
in the path.
I came across this because some users use "#" in their user name, then
files in their user directory is inaccessible using wxFileSystemHandler.
I'm not sure how to work around this or if there is a way to escape the
path?
For reference, here is the code from wxWidgets 3.0 (I think this is an
issue with earlier versions as well):
wxString wxFileSystemHandler::GetRightLocation(const wxString& location)
{
int i, l = location.length();
int l2 = l + 1;
for (i = l-1;
(i >= 0) &&
((location[i] != wxT(':')) || (i == 1) || (location[i-2] ==
wxT(':')));
i--)
{
if (location[i] == wxT('#')) l2 = i + 1;
}
if (i == 0) return wxEmptyString;
else return location.Mid(i + 1, l2 - i - 2);
}
Thanks
Kobus
OS: Windows (and other I would think)
wx Version: wxWidgets 3.0
There seems to be an issue with the way wxArchiveFSHandler (and
wxFileSystemHandler) handles a # in the path provided to it.
Let's say you have a zip file in a folder with a # in it, like so:
C:/work/test#1/data.zip
The url to open a file "test.txt" in the archive would be:
file:C:/work/test#1/data.zip#zip:test.txt
Then wxArchiveFSHandler will not find the file data.zip because of the #
earlier in the path.
The problem is when wxArchiveFSHandler uses wxFileSystemHandler to open
the file because wxFileSystemHandler::GetRightLocation()
returns "C:/work/test" instead of "C:/work/test#1/data.zip" due to the #
in the path.
I came across this because some users use "#" in their user name, then
files in their user directory is inaccessible using wxFileSystemHandler.
I'm not sure how to work around this or if there is a way to escape the
path?
For reference, here is the code from wxWidgets 3.0 (I think this is an
issue with earlier versions as well):
wxString wxFileSystemHandler::GetRightLocation(const wxString& location)
{
int i, l = location.length();
int l2 = l + 1;
for (i = l-1;
(i >= 0) &&
((location[i] != wxT(':')) || (i == 1) || (location[i-2] ==
wxT(':')));
i--)
{
if (location[i] == wxT('#')) l2 = i + 1;
}
if (i == 0) return wxEmptyString;
else return location.Mid(i + 1, l2 - i - 2);
}
Thanks
Kobus
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users