Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/DefaultFileSystem.cpp

Issue 29538640: Issue 5610 - Deal with a '/' base path (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Changes from review Created Sept. 8, 2017, 1:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/DefaultFileSystem.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/DefaultFileSystem.cpp
===================================================================
--- a/src/DefaultFileSystem.cpp
+++ b/src/DefaultFileSystem.cpp
@@ -66,17 +66,17 @@
return path;
}
#endif
}
DefaultFileSystemSync::DefaultFileSystemSync(const std::string& path)
: basePath(path)
{
- if (!basePath.empty() && *basePath.rbegin() == PATH_SEPARATOR)
+ if (basePath.size() > 1 && *basePath.rbegin() == PATH_SEPARATOR)
{
basePath.resize(basePath.size() - 1);
}
}
IFileSystem::IOBuffer
DefaultFileSystemSync::Read(const std::string& path) const
{
@@ -178,17 +178,20 @@
else
{
#ifdef _WIN32
if (PathIsRelative(NormalizePath(path).c_str()))
#else
if (path.length() && *path.begin() != PATH_SEPARATOR)
#endif
{
- return basePath + PATH_SEPARATOR + path;
+ if (*basePath.rbegin() != PATH_SEPARATOR)
+ return basePath + PATH_SEPARATOR + path;
+ else
+ return basePath + path;
}
else
{
return path;
}
}
}
« no previous file with comments | « no previous file | test/DefaultFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld