diff options
author | Mark Spruiell <mes@zeroc.com> | 2004-06-16 22:16:54 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2004-06-16 22:16:54 +0000 |
commit | 867340ecac32395b97a3746b7164b9e4b8f07940 (patch) | |
tree | 9217c7ff15a5d255e37542957312daa81740c5bd /cpp/src/IcePatch/ClientUtil.cpp | |
parent | Cosmetic fixes. (diff) | |
download | ice-867340ecac32395b97a3746b7164b9e4b8f07940.tar.bz2 ice-867340ecac32395b97a3746b7164b9e4b8f07940.tar.xz ice-867340ecac32395b97a3746b7164b9e4b8f07940.zip |
adding checkDirectory
Diffstat (limited to 'cpp/src/IcePatch/ClientUtil.cpp')
-rw-r--r-- | cpp/src/IcePatch/ClientUtil.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cpp/src/IcePatch/ClientUtil.cpp b/cpp/src/IcePatch/ClientUtil.cpp index 3d08927196c..238eccdab20 100644 --- a/cpp/src/IcePatch/ClientUtil.cpp +++ b/cpp/src/IcePatch/ClientUtil.cpp @@ -212,3 +212,48 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB) return calcMD5(path, false); } + +void +IcePatch::checkDirectory(const string& path, bool dynamic, const LoggerPtr& logger) +{ + FileInfo info = getFileInfo(path, true, logger); + if(info.type != FileTypeDirectory) + { + FileAccessException ex; + ex.reason = "`" + path + "' is not a directory"; + throw ex; + } + + StringSeq paths = readDirectory(path); + for(StringSeq::const_iterator p = paths.begin(); p < paths.end(); ++p) + { + if(!ignoreSuffix(*p)) + { + string subPath = *p; + FileInfo subInfo = getFileInfo(subPath, true, logger); + if(subInfo.type == FileTypeDirectory) + { + checkDirectory(subPath, dynamic, logger); + } + else + { + FileInfo subInfoMD5 = getFileInfo(subPath + ".md5", false, logger); + if(dynamic && subInfoMD5.type != FileTypeNotExist) + { + removeRecursive(subPath + ".md5"); + } + else if(!dynamic && (subInfoMD5.type == FileTypeNotExist || subInfoMD5.time < subInfo.time)) + { + createMD5(subPath, dynamic, logger); + } + } + } + } + + info = getFileInfo(path, true, logger); // Get current timestamp. + FileInfo infoMD5 = getFileInfo(path + ".md5", false, logger); + if(infoMD5.type == FileTypeNotExist || infoMD5.time < info.time) + { + createMD5(path, dynamic, logger); + } +} |