Move URL<->filename conversion functions to wxFileName

This ensures that they are always available and can be used in
wxLaunchDefaultBrowser() in all build variants, whereas before this
function didn't handle file:// URLs correctly when the library was built
with wxUSE_FILESYSTEM==0.

Closes https://github.com/wxWidgets/wxWidgets/pull/1469

Closes #10414.
This commit is contained in:
oneeyeman1
2019-08-24 00:49:25 -05:00
committed by Vadim Zeitlin
parent 5e7b515349
commit 14bcf09924
8 changed files with 133 additions and 100 deletions

View File

@@ -246,7 +246,7 @@ void FileFunctionsTestCase::DoFindFile(const wxString& filePath)
// Check if file can be found (method 2).
wxFileSystem fs;
wxString furl = fs.FindFirst(filePath, wxFILE);
wxFileName fname = wxFileSystem::URLToFileName(furl);
wxFileName fname = wxFileName::URLToFileName(furl);
foundFile = fname.GetFullPath();
CPPUNIT_ASSERT_MESSAGE( msg, foundFile == filePath );
@@ -271,10 +271,10 @@ void FileFunctionsTestCase::FindFileNext()
// Check using method 2.
wxFileSystem fs;
wxString furl = fs.FindFirst(fileMask, wxFILE);
fn1 = wxFileSystem::URLToFileName(furl);
fn1 = wxFileName::URLToFileName(furl);
foundFile1 = fn1.GetFullPath();
furl = fs.FindNext();
fn2 = wxFileSystem::URLToFileName(furl);
fn2 = wxFileName::URLToFileName(furl);
foundFile2 = fn2.GetFullPath();
// Full names must be different.
CPPUNIT_ASSERT( fn1.GetFullPath() != fn2.GetFullPath() );