summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch/Util.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-12-11 16:01:20 +0000
committerMarc Laukien <marc@zeroc.com>2003-12-11 16:01:20 +0000
commitb0b5166f2f0f55894932f77b803b7ea797cc5baa (patch)
tree145de22439461bdefd14a72a1f9dc22ac15bcf3a /cpp/src/IcePatch/Util.cpp
parentthe icepatch server now doesn't chdir anymore (diff)
downloadice-b0b5166f2f0f55894932f77b803b7ea797cc5baa.tar.bz2
ice-b0b5166f2f0f55894932f77b803b7ea797cc5baa.tar.xz
ice-b0b5166f2f0f55894932f77b803b7ea797cc5baa.zip
the icepatch server now doesn't chdir anymore
Diffstat (limited to 'cpp/src/IcePatch/Util.cpp')
-rw-r--r--cpp/src/IcePatch/Util.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/cpp/src/IcePatch/Util.cpp b/cpp/src/IcePatch/Util.cpp
index 859eee8a37b..79950e4a19d 100644
--- a/cpp/src/IcePatch/Util.cpp
+++ b/cpp/src/IcePatch/Util.cpp
@@ -351,14 +351,20 @@ IcePatch::removeRecursive(const string& path, const Ice::LoggerPtr& logger)
StringSeq
IcePatch::readDirectory(const string& path)
{
+ return readDirectory(path, path);
+}
+
+StringSeq
+IcePatch::readDirectory(const string& realPath, const string& prependPath)
+{
#ifdef _WIN32
struct _finddata_t data;
- long h = _findfirst((path + "/*").c_str(), &data);
+ long h = _findfirst((realPath + "/*").c_str(), &data);
if(h == -1)
{
FileAccessException ex;
- ex.reason = "cannot read directory `" + path + "': " + strerror(errno);
+ ex.reason = "cannot read directory `" + realPath + "': " + strerror(errno);
throw ex;
}
@@ -371,7 +377,7 @@ IcePatch::readDirectory(const string& path)
if(name != ".." && name != ".")
{
- result.push_back(normalizePath(path + '/' + name));
+ result.push_back(normalizePath(prependPath + '/' + name));
}
if(_findnext(h, &data) == -1)
@@ -382,7 +388,7 @@ IcePatch::readDirectory(const string& path)
}
FileAccessException ex;
- ex.reason = "cannot read directory `" + path + "': " + strerror(errno);
+ ex.reason = "cannot read directory `" + realPath + "': " + strerror(errno);
_findclose(h);
throw ex;
}
@@ -397,11 +403,11 @@ IcePatch::readDirectory(const string& path)
#else
struct dirent **namelist;
- int n = ::scandir(path.c_str(), &namelist, 0, alphasort);
+ int n = ::scandir(realPath.c_str(), &namelist, 0, alphasort);
if(n < 0)
{
FileAccessException ex;
- ex.reason = "cannot read directory `" + path + "': " + strerror(errno);
+ ex.reason = "cannot read directory `" + realPath + "': " + strerror(errno);
throw ex;
}
@@ -417,7 +423,7 @@ IcePatch::readDirectory(const string& path)
if(name != ".." && name != ".")
{
- result.push_back(normalizePath(path + '/' + name));
+ result.push_back(normalizePath(prependPath + '/' + name));
}
}