From b221ecdd948611fd249defe4e96a51a850bd53a5 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Mon, 26 May 2014 17:21:48 -0500 Subject: [PATCH] Fix for empty paths breaking in getCanonicalPath(). --- src/Util.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Util.cpp b/src/Util.cpp index a6540fd76..acff2d28a 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -62,16 +62,11 @@ Eigen::Vector2f roundVector(const Eigen::Vector2f& vec) return ret; } +// embedded resources, e.g. ":/font.ttf", need to be properly handled too std::string getCanonicalPath(const std::string& path) { - // embedded resources, e.g. ":/font.ttf", need to be properly handled too - try - { - const std::string canonical = boost::filesystem::canonical(path).generic_string(); - return canonical.empty() ? path : canonical; - } - catch (boost::filesystem::filesystem_error& e) - { + if(path.empty() || !boost::filesystem::exists(path)) return path; - } + + return boost::filesystem::canonical(path).generic_string(); }