Windows: fix path splitting for the XP field
This commit is contained in:
@@ -805,6 +805,29 @@ string url_gpath(const string& url)
|
||||
return path_canon(url.substr(colon+1));
|
||||
}
|
||||
|
||||
string url_gpathS(const string& url)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
string u = url_gpath(url);
|
||||
string nu;
|
||||
if (path_hasdrive(u)) {
|
||||
nu.append(1, '/');
|
||||
nu.append(1, u[0]);
|
||||
if (path_isdriveabs(u)) {
|
||||
nu.append(u.substr(2));
|
||||
} else {
|
||||
// This should be an error really
|
||||
nu.append(1, '/');
|
||||
nu.append(u.substr(2));
|
||||
}
|
||||
}
|
||||
return nu;
|
||||
#else
|
||||
return url_gpath(url);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
string url_parentfolder(const string& url)
|
||||
{
|
||||
// In general, the parent is the directory above the full path
|
||||
|
||||
@@ -67,6 +67,12 @@ extern std::string url_parentfolder(const std::string& url);
|
||||
/// routine, it does the right thing only in the recoll context
|
||||
extern std::string url_gpath(const std::string& url);
|
||||
|
||||
/// Same but, in the case of a Windows local path, also turn "c:/" into
|
||||
/// "/c/" This should be used only for splitting the path in rcldb, it
|
||||
/// would better be local in there, but I prefer to keep all the
|
||||
/// system-specific path stuff in pathut
|
||||
extern std::string url_gpathS(const std::string& url);
|
||||
|
||||
/// Stat parameter and check if it's a directory
|
||||
extern bool path_isdir(const std::string& path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user