Skip to content
Snippets Groups Projects
Commit 05708914 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

From Axel:

fix in conversion of cygpath to windows path.


git-svn-id: http://root.cern.ch/svn/root/trunk@36823 27541ba8-7e3a-0410-8455-c3a389f83636
parent 3c67b90c
Branches
Tags
No related merge requests found
...@@ -35,7 +35,7 @@ static const char *GetCygwinRootDir() { ...@@ -35,7 +35,7 @@ static const char *GetCygwinRootDir() {
static bool FromCygToNativePath(std::string& path) { static bool FromCygToNativePath(std::string& path) {
// Convert a cygwin path (/cygdrive/x/...,/home) // Convert a cygwin path (/cygdrive/x/...,/home)
// to a native Windows path. Return whether the path was changed. // to a native Windows path. Return whether the path was changed.
static std::string cygRoot;
size_t posCygDrive = path.find("/cygdrive/"); size_t posCygDrive = path.find("/cygdrive/");
if (posCygDrive != std::string::npos) { if (posCygDrive != std::string::npos) {
path[posCygDrive] = path[posCygDrive + 10]; path[posCygDrive] = path[posCygDrive + 10];
...@@ -45,13 +45,14 @@ static bool FromCygToNativePath(std::string& path) { ...@@ -45,13 +45,14 @@ static bool FromCygToNativePath(std::string& path) {
} else { } else {
size_t posHome = path.find("/home/"); size_t posHome = path.find("/home/");
if (posHome != std::string::npos) { if (posHome != std::string::npos) {
std::string fname = GetCygwinRootDir(); if (cygRoot.empty()) {
if (fname[fname.length() - 1] == '/') { cygRoot = GetCygwinRootDir();
fname += posHome + 1; size_t len = cygRoot.length();
} else { if (cygRoot[len - 1] == '/') {
fname += posHome; cygRoot.erase(len - 1);
}
} }
path = fname; path.insert(posHome, cygRoot);
return true; return true;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment