mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
Fix for empty paths breaking in getCanonicalPath().
This commit is contained in:
parent
e5ac225362
commit
b221ecdd94
13
src/Util.cpp
13
src/Util.cpp
|
@ -62,16 +62,11 @@ Eigen::Vector2f roundVector(const Eigen::Vector2f& vec)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// embedded resources, e.g. ":/font.ttf", need to be properly handled too
|
||||||
std::string getCanonicalPath(const std::string& path)
|
std::string getCanonicalPath(const std::string& path)
|
||||||
{
|
{
|
||||||
// embedded resources, e.g. ":/font.ttf", need to be properly handled too
|
if(path.empty() || !boost::filesystem::exists(path))
|
||||||
try
|
|
||||||
{
|
|
||||||
const std::string canonical = boost::filesystem::canonical(path).generic_string();
|
|
||||||
return canonical.empty() ? path : canonical;
|
|
||||||
}
|
|
||||||
catch (boost::filesystem::filesystem_error& e)
|
|
||||||
{
|
|
||||||
return path;
|
return path;
|
||||||
}
|
|
||||||
|
return boost::filesystem::canonical(path).generic_string();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue