mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-03 17:14:46 +00:00
Fixed: CPath::makePathAbsolute removing first /
This commit is contained in:
parent
cc888d2dec
commit
23ec09c4b1
1 changed files with 10 additions and 6 deletions
|
@ -2578,13 +2578,13 @@ std::string CPath::makePathAbsolute( const std::string &relativePath, const std:
|
||||||
{
|
{
|
||||||
absolutePath = relativePath;
|
absolutePath = relativePath;
|
||||||
}
|
}
|
||||||
#else
|
else
|
||||||
// Unix filesystem absolute path
|
#endif
|
||||||
|
// Unix filesystem absolute path (works also under Windows)
|
||||||
if (relativePath[0] == '/')
|
if (relativePath[0] == '/')
|
||||||
{
|
{
|
||||||
absolutePath = relativePath;
|
absolutePath = relativePath;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add a slash to the directory if necessary.
|
// Add a slash to the directory if necessary.
|
||||||
|
@ -2610,14 +2610,15 @@ std::string CPath::makePathAbsolute( const std::string &relativePath, const std:
|
||||||
|
|
||||||
// Now build the new absolute path
|
// Now build the new absolute path
|
||||||
absolutePath += relativePath;
|
absolutePath += relativePath;
|
||||||
absolutePath = standardizePath(absolutePath, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
absolutePath = standardizePath(absolutePath, true);
|
||||||
|
|
||||||
if (simplify)
|
if (simplify)
|
||||||
{
|
{
|
||||||
// split all components path to manage parent directories
|
// split all components path to manage parent directories
|
||||||
std::vector<std::string> tokens;
|
std::vector<std::string> tokens;
|
||||||
explode(absolutePath, std::string("/"), tokens, true);
|
explode(absolutePath, std::string("/"), tokens, false);
|
||||||
|
|
||||||
std::vector<std::string> directoryParts;
|
std::vector<std::string> directoryParts;
|
||||||
|
|
||||||
|
@ -2649,7 +2650,10 @@ std::string CPath::makePathAbsolute( const std::string &relativePath, const std:
|
||||||
|
|
||||||
// rebuild the whole absolute path
|
// rebuild the whole absolute path
|
||||||
for(uint i = 1, len = directoryParts.size(); i < len; ++i)
|
for(uint i = 1, len = directoryParts.size(); i < len; ++i)
|
||||||
absolutePath += "/" + directoryParts[i];
|
{
|
||||||
|
if (!directoryParts[i].empty())
|
||||||
|
absolutePath += "/" + directoryParts[i];
|
||||||
|
}
|
||||||
|
|
||||||
// add trailing slash
|
// add trailing slash
|
||||||
absolutePath += "/";
|
absolutePath += "/";
|
||||||
|
|
Loading…
Reference in a new issue