diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-05 18:40:37 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-05 18:40:37 +0000 |
commit | 86f6f01a19f122bfd47c0c2c6badc0f54de01250 (patch) | |
tree | 1267a4146a2ea8dd53e13014eb89ae0f81c77467 /cpp/src/IcePatch/Util.cpp | |
parent | fixing ConcurrentModificationException in stopAll (diff) | |
download | ice-86f6f01a19f122bfd47c0c2c6badc0f54de01250.tar.bz2 ice-86f6f01a19f122bfd47c0c2c6badc0f54de01250.tar.xz ice-86f6f01a19f122bfd47c0c2c6badc0f54de01250.zip |
fixes for WIN32
Diffstat (limited to 'cpp/src/IcePatch/Util.cpp')
-rw-r--r-- | cpp/src/IcePatch/Util.cpp | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/cpp/src/IcePatch/Util.cpp b/cpp/src/IcePatch/Util.cpp index f230706c013..7646d4c929c 100644 --- a/cpp/src/IcePatch/Util.cpp +++ b/cpp/src/IcePatch/Util.cpp @@ -137,6 +137,42 @@ IcePatch::getFileInfo(const string& path) return FileInfoUnknown; } +void +IcePatch::removeRecursive(const string& path) +{ + if (getFileInfo(path) == FileInfoDirectory) + { + StringSeq paths = readDirectory(path); + StringSeq::const_iterator p; + for (p = paths.begin(); p != paths.end(); ++p) + { + removeRecursive(*p); + } + } + + if (::remove(path.c_str()) == -1) + { + NodeAccessException ex; + ex.reason = "cannot remove file `" + path + "': " + strerror(errno); + throw ex; + } +} + +void +IcePatch::changeDirectory(const string& path) +{ +#ifdef WIN32 + if (_chdir(path.c_str()) == -1) +#else + if (chdir(path.c_str()) == -1) +#endif + { + NodeAccessException ex; + ex.reason = "cannot change to directory `" + path + "': " + strerror(errno); + throw ex; + } +} + StringSeq IcePatch::readDirectory(const string& path) { @@ -213,27 +249,6 @@ IcePatch::readDirectory(const string& path) } void -IcePatch::removeRecursive(const string& path) -{ - if (getFileInfo(path) == FileInfoDirectory) - { - StringSeq paths = readDirectory(path); - StringSeq::const_iterator p; - for (p = paths.begin(); p != paths.end(); ++p) - { - removeRecursive(*p); - } - } - - if (::remove(path.c_str()) == -1) - { - NodeAccessException ex; - ex.reason = "cannot remove file `" + path + "': " + strerror(errno); - throw ex; - } -} - -void IcePatch::createDirectory(const string& path) { #ifdef WIN32 |