- static const int lenPrefix = 5; // strlen("file:")
- if ( filename.Left(lenPrefix).MakeLower() == _T("file:") )
+ size_t lenPrefix = 5; // strlen("file:")
+ if ( filename.Left(lenPrefix).MakeLower() == wxT("file:") )
+ {
+ // sometimes the syntax is "file:filename", sometimes it's
+ // URL-like: "file://filename" - deal with both
+ if ( filename[lenPrefix] == wxT('/') &&
+ filename[lenPrefix + 1] == wxT('/') )
+ {
+ // skip the slashes
+ lenPrefix += 2;
+ }
+
+ AddFile(wxURI::Unescape(filename.c_str() + lenPrefix));
+ filename.Empty();
+ }
+ else