Second try to fix conversion from uri to string path
'file://System/Library/Fonts/Helvetica.ttc#postscript-name=Helvetica' -> '/System/Library/Fonts/Helvetica.ttc'
This commit is contained in:
parent
20c72c527a
commit
650447cf02
1 changed files with 4 additions and 7 deletions
|
@ -55,13 +55,10 @@ static std::string get_file_path(const wxFont& font) {
|
||||||
if (url == NULL) return {};
|
if (url == NULL) return {};
|
||||||
wxString file_uri;
|
wxString file_uri;
|
||||||
wxCFTypeRef(url).GetValue(file_uri);
|
wxCFTypeRef(url).GetValue(file_uri);
|
||||||
std::string file_path(wxURI::Unescape(file_uri).c_str());
|
wxURI uri(file_uri);
|
||||||
size_t start = std::string("file://").size();
|
const wxString &path = uri.GetPath();
|
||||||
if (file_path.empty() || file_path.size() <= start)
|
BOOST_LOG_TRIVIAL(trace) << "input uri(" << file_uri.c_str() << ") convert to path(" << path.c_str() << ").";
|
||||||
return {};
|
return std::string(path.c_str());
|
||||||
// remove prefix file://
|
|
||||||
file_path = file_path.substr(start, file_path.size() - start);
|
|
||||||
return file_path;
|
|
||||||
}
|
}
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue