Normalise paths.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
dfae404334
commit
2d60d802a2
1 changed files with 9 additions and 4 deletions
|
@ -50,14 +50,19 @@ namespace
|
|||
|
||||
for (const std::string & path : paths)
|
||||
{
|
||||
const std::string resourcePath = path + target;
|
||||
if (dirExists(resourcePath))
|
||||
char * real = realpath(path.c_str(), nullptr);
|
||||
if (real)
|
||||
{
|
||||
return resourcePath;
|
||||
const std::string resourcePath = std::string(real) + target;
|
||||
free(real);
|
||||
if (dirExists(resourcePath))
|
||||
{
|
||||
return resourcePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error("Cannot found the resource path");
|
||||
throw std::runtime_error("Cannot found the resource path: " + target);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue