diff options
author | Jose <jose@zeroc.com> | 2009-08-12 17:59:22 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2009-08-12 17:59:22 +0200 |
commit | e33a0af8f6fef372c9f8bec22629b1460d2e8c70 (patch) | |
tree | 67c9e68437084d255a3725dd08092f5892023b26 /cpp/src/IcePatch2/Util.cpp | |
parent | 2564 - removeServantLocator remaining issues. (diff) | |
download | ice-e33a0af8f6fef372c9f8bec22629b1460d2e8c70.tar.bz2 ice-e33a0af8f6fef372c9f8bec22629b1460d2e8c70.tar.xz ice-e33a0af8f6fef372c9f8bec22629b1460d2e8c70.zip |
4071 - merge contents of OS.cpp/OS.h into FileUtil.h/FileUtil.cpp.
Diffstat (limited to 'cpp/src/IcePatch2/Util.cpp')
-rw-r--r-- | cpp/src/IcePatch2/Util.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp index 1c12c1694e4..135ea08ab2c 100644 --- a/cpp/src/IcePatch2/Util.cpp +++ b/cpp/src/IcePatch2/Util.cpp @@ -18,12 +18,12 @@ #include <IceUtil/DisableWarnings.h> #include <IceUtil/IceUtil.h> #include <IceUtil/StringUtil.h> +#include <IceUtil/FileUtil.h> #define ICE_PATCH2_API_EXPORTS #include <IcePatch2/Util.h> #include <openssl/sha.h> #include <bzlib.h> #include <iomanip> -#include <OS.h> #ifdef _WIN32 # include <direct.h> @@ -403,9 +403,9 @@ IcePatch2::rename(const string& fromPa, const string& toPa) const string fromPath = simplify(fromPa); const string toPath = simplify(toPa); - IceInternal::OS::remove(toPath); // We ignore errors, as the file we are renaming to might not exist. + IceUtilInternal::remove(toPath); // We ignore errors, as the file we are renaming to might not exist. - if(IceInternal::OS::rename(fromPath ,toPath) == -1) + if(IceUtilInternal::rename(fromPath ,toPath) == -1) { throw "cannot rename `" + fromPath + "' to `" + toPath + "': " + IceUtilInternal::lastErrorToString(); } @@ -416,15 +416,15 @@ IcePatch2::remove(const string& pa) { const string path = simplify(pa); - IceInternal::OS::structstat buf; - if(IceInternal::OS::osstat(path, &buf) == -1) + IceUtilInternal::structstat buf; + if(IceUtilInternal::stat(path, &buf) == -1) { throw "cannot stat `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } if(S_ISDIR(buf.st_mode)) { - if(IceInternal::OS::rmdir(path) == -1) + if(IceUtilInternal::rmdir(path) == -1) { if(errno == EACCES) { @@ -435,7 +435,7 @@ IcePatch2::remove(const string& pa) } else { - if(IceInternal::OS::remove(path) == -1) + if(IceUtilInternal::remove(path) == -1) { throw "cannot remove file `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -447,8 +447,8 @@ IcePatch2::removeRecursive(const string& pa) { const string path = simplify(pa); - IceInternal::OS::structstat buf; - if(IceInternal::OS::osstat(path, &buf) == -1) + IceUtilInternal::structstat buf; + if(IceUtilInternal::stat(path, &buf) == -1) { throw "cannot stat `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -463,7 +463,7 @@ IcePatch2::removeRecursive(const string& pa) if(!isRoot(path)) { - if(IceInternal::OS::rmdir(path) == -1) + if(IceUtilInternal::rmdir(path) == -1) { throw "cannot remove directory `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -471,7 +471,7 @@ IcePatch2::removeRecursive(const string& pa) } else { - if(IceInternal::OS::remove(path) == -1) + if(IceUtilInternal::remove(path) == -1) { throw "cannot remove file `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -607,7 +607,7 @@ IcePatch2::createDirectory(const string& pa) { const string path = simplify(pa); - if(IceInternal::OS::mkdir(path, 0777) == -1) + if(IceUtilInternal::mkdir(path, 0777) == -1) { if(errno != EEXIST) { @@ -629,8 +629,8 @@ IcePatch2::createDirectoryRecursive(const string& pa) if(!isRoot(path + "/")) { - IceInternal::OS::structstat buf; - if(IceInternal::OS::osstat(path, &buf) != -1) + IceUtilInternal::structstat buf; + if(IceUtilInternal::stat(path, &buf) != -1) { if(S_ISDIR(buf.st_mode)) { @@ -638,7 +638,7 @@ IcePatch2::createDirectoryRecursive(const string& pa) } } - if(IceInternal::OS::mkdir(path, 0777) == -1) + if(IceUtilInternal::mkdir(path, 0777) == -1) { if(errno != EEXIST) { @@ -653,7 +653,7 @@ IcePatch2::compressBytesToFile(const string& pa, const ByteSeq& bytes, Int pos) { const string path = simplify(pa); - FILE* stdioFile = IceInternal::OS::fopen(path, "wb"); + FILE* stdioFile = IceUtilInternal::fopen(path, "wb"); if(!stdioFile) { throw "cannot open `" + path + "' for writing:\n" + IceUtilInternal::lastErrorToString(); @@ -713,13 +713,13 @@ IcePatch2::decompressFile(const string& pa) try { - fp = IceInternal::OS::fopen(path, "wb"); + fp = IceUtilInternal::fopen(path, "wb"); if(!fp) { throw "cannot open `" + path + "' for writing:\n" + IceUtilInternal::lastErrorToString(); } - stdioFileBZ2 = IceInternal::OS::fopen(pathBZ2, "rb"); + stdioFileBZ2 = IceUtilInternal::fopen(pathBZ2, "rb"); if(!stdioFileBZ2) { throw "cannot open `" + pathBZ2 + "' for reading:\n" + IceUtilInternal::lastErrorToString(); @@ -854,8 +854,8 @@ IcePatch2::setFileFlags(const string& pa, const FileInfo& info) { #ifndef _WIN32 // Windows doesn't support the executable flag const string path = simplify(pa); - IceInternal::OS::structstat buf; - if(IceInternal::OS::osstat(path, &buf) == -1) + IceUtilInternal::structstat buf; + if(IceUtilInternal::stat(path, &buf) == -1) { throw "cannot stat `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -889,8 +889,8 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G } else { - IceInternal::OS::structstat buf; - if(IceInternal::OS::osstat(getWithoutSuffix(path), &buf) == -1) + IceUtilInternal::structstat buf; + if(IceUtilInternal::stat(getWithoutSuffix(path), &buf) == -1) { if(errno == ENOENT) { @@ -920,8 +920,8 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G else { - IceInternal::OS::structstat buf; - if(IceInternal::OS::osstat(path, &buf) == -1) + IceUtilInternal::structstat buf; + if(IceUtilInternal::stat(path, &buf) == -1) { throw "cannot stat `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -970,7 +970,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G info.executable = buf.st_mode & S_IXUSR; #endif - IceInternal::OS::structstat bufBZ2; + IceUtilInternal::structstat bufBZ2; const string pathBZ2 = path + ".bz2"; bool doCompress = false; if(buf.st_size != 0 && compress > 0) @@ -980,7 +980,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G // compress == 1: Compress if necessary. // compress >= 2: Always compress. // - if(compress >= 2 || IceInternal::OS::osstat(pathBZ2, &bufBZ2) == -1 || buf.st_mtime >= bufBZ2.st_mtime) + if(compress >= 2 || IceUtilInternal::stat(pathBZ2, &bufBZ2) == -1 || buf.st_mtime >= bufBZ2.st_mtime) { if(cb && !cb->compress(relPath)) { @@ -1023,7 +1023,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G // if(doCompress) { - int fd = IceInternal::OS::open(path.c_str(), O_BINARY|O_RDONLY); + int fd = IceUtilInternal::open(path.c_str(), O_BINARY|O_RDONLY); if(fd == -1) { throw "cannot open `" + path + "' for reading:\n" + IceUtilInternal::lastErrorToString(); @@ -1055,7 +1055,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G close(fd); const string pathBZ2Temp = path + ".bz2temp"; - FILE* stdioFile = IceInternal::OS::fopen(pathBZ2Temp, "wb"); + FILE* stdioFile = IceUtilInternal::fopen(pathBZ2Temp, "wb"); if(fwrite(&compressedBytes[0], compressedLen, 1, stdioFile) != 1) { fclose(stdioFile); @@ -1069,7 +1069,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G } #endif - int fd = IceInternal::OS::open(path.c_str(), O_BINARY|O_RDONLY); + int fd = IceUtilInternal::open(path.c_str(), O_BINARY|O_RDONLY); if(fd == -1) { throw "cannot open `" + path + "' for reading:\n" + IceUtilInternal::lastErrorToString(); @@ -1082,7 +1082,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G BZFILE* bzFile = 0; if(doCompress) { - stdioFile = IceInternal::OS::fopen(simplify(pathBZ2Temp), "wb"); + stdioFile = IceUtilInternal::fopen(simplify(pathBZ2Temp), "wb"); if(!stdioFile) { #if defined(_MSC_VER) && (_MSC_VER >= 1400) @@ -1191,7 +1191,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G rename(pathBZ2Temp, pathBZ2); - if(IceInternal::OS::osstat(pathBZ2, &bufBZ2) == -1) + if(IceUtilInternal::stat(pathBZ2, &bufBZ2) == -1) { throw "cannot stat `" + pathBZ2 + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -1244,7 +1244,7 @@ IcePatch2::saveFileInfoSeq(const string& pa, const FileInfoSeq& infoSeq) { const string path = simplify(pa + '/' + checksumFile); - FILE* fp = IceInternal::OS::fopen(path, "w"); + FILE* fp = IceUtilInternal::fopen(path, "w"); if(!fp) { throw "cannot open `" + path + "' for writing:\n" + IceUtilInternal::lastErrorToString(); @@ -1286,7 +1286,7 @@ IcePatch2::loadFileInfoSeq(const string& pa, FileInfoSeq& infoSeq) { const string path = simplify(pa + '/' + checksumFile); - FILE* fp = IceInternal::OS::fopen(path, "r"); + FILE* fp = IceUtilInternal::fopen(path, "r"); if(!fp) { throw "cannot open `" + path + "' for reading:\n" + IceUtilInternal::lastErrorToString(); @@ -1313,7 +1313,7 @@ IcePatch2::loadFileInfoSeq(const string& pa, FileInfoSeq& infoSeq) { const string pathLog = simplify(pa + '/' + logFile); - FILE* fp = IceInternal::OS::fopen(pathLog, "r"); + FILE* fp = IceUtilInternal::fopen(pathLog, "r"); if(fp != 0) { FileInfoSeq remove; |