X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7e86b10b7bced8fd5640e6db75e3232a65146496..beb9e8f2eda04520eb9a31e95315a88b1acd3179:/src/common/utilscmn.cpp diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 4457a14ebe..afcfa394dd 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -182,7 +182,7 @@ wxString wxNow() return wxEmptyString; #endif #else - time_t now = time((time_t *) NULL); + time_t now = time(NULL); char *date = ctime(&now); date[24] = '\0'; return wxString::FromAscii(date); @@ -1001,8 +1001,7 @@ static bool DoLaunchDefaultBrowserHelper(const wxString& urlOrig, int flags) // this check is useful to avoid that wxURI recognizes as scheme parts of // the filename, in case urlOrig is a local filename // (e.g. "C:\\test.txt" when parsed by wxURI reports a scheme == "C") - bool hasValidScheme = uri.HasScheme() && - (uri.GetScheme() == "http" || uri.GetScheme() == "file"); + bool hasValidScheme = uri.HasScheme() && uri.GetScheme().length() > 1; #if defined(__WXMSW__) @@ -1011,10 +1010,14 @@ static bool DoLaunchDefaultBrowserHelper(const wxString& urlOrig, int flags) // // for (int i=0; i<2; i++) // { + // // test arguments without a valid URL scheme: // wxLaunchDefaultBrowser("C:\\test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW); // wxLaunchDefaultBrowser("wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); + // + // // test arguments with different valid schemes: // wxLaunchDefaultBrowser("file:/C%3A/test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW); // wxLaunchDefaultBrowser("http://wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); + // wxLaunchDefaultBrowser("mailto:user@host.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); // } // (assuming you have a C:\test.txt file) @@ -1037,9 +1040,13 @@ static bool DoLaunchDefaultBrowserHelper(const wxString& urlOrig, int flags) if ( uri.GetScheme() == "file" ) { - // ShellExecuteEx() doesn't like the "file" scheme when opening local files; + // TODO: extract URLToFileName() to some always compiled in + // function +#if wxUSE_FILESYSTEM + // ShellExecuteEx() doesn't like the "file" scheme when opening local files; // remove it url = wxFileSystem::URLToFileName(url).GetFullPath(); +#endif // wxUSE_FILESYSTEM } }