From 650447cf021d04d31b5ca8a6b40f3d4307e3346d Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Thu, 23 Feb 2023 12:01:26 +0100 Subject: [PATCH] Second try to fix conversion from uri to string path 'file://System/Library/Fonts/Helvetica.ttc#postscript-name=Helvetica' -> '/System/Library/Fonts/Helvetica.ttc' --- src/slic3r/Utils/WxFontUtils.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/slic3r/Utils/WxFontUtils.cpp b/src/slic3r/Utils/WxFontUtils.cpp index a56f331412..ebcd0d9a01 100644 --- a/src/slic3r/Utils/WxFontUtils.cpp +++ b/src/slic3r/Utils/WxFontUtils.cpp @@ -55,13 +55,10 @@ static std::string get_file_path(const wxFont& font) { if (url == NULL) return {}; wxString file_uri; wxCFTypeRef(url).GetValue(file_uri); - std::string file_path(wxURI::Unescape(file_uri).c_str()); - size_t start = std::string("file://").size(); - if (file_path.empty() || file_path.size() <= start) - return {}; - // remove prefix file:// - file_path = file_path.substr(start, file_path.size() - start); - return file_path; + wxURI uri(file_uri); + const wxString &path = uri.GetPath(); + BOOST_LOG_TRIVIAL(trace) << "input uri(" << file_uri.c_str() << ") convert to path(" << path.c_str() << ")."; + return std::string(path.c_str()); } #endif // __APPLE__ } // namespace