diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-27 23:35:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-27 23:35:41 +0400 |
commit | f5b60afe4ec924f12ec859e4ca51cd8ed9eab3ad (patch) | |
tree | 915eb15ebf8f2408ad3f035dc2d1c7288208ed58 /intern/cycles/util/util_path.cpp | |
parent | d1ef6ac79b9bc6f17e61802bea3c3c2fbfcfcfd0 (diff) |
Cycles: fix error in md5 hash computation for files in directories below
the first level.
Diffstat (limited to 'intern/cycles/util/util_path.cpp')
-rw-r--r-- | intern/cycles/util/util_path.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp index d3f739e19f6..55e6a95b54a 100644 --- a/intern/cycles/util/util_path.cpp +++ b/intern/cycles/util/util_path.cpp @@ -85,17 +85,14 @@ bool path_exists(const string& path) return boost::filesystem::exists(path); } -string path_files_md5_hash(const string& dir) +static void path_files_md5_hash_recursive(MD5Hash& hash, const string& dir) { - /* computes md5 hash of all files in the directory */ - MD5Hash hash; - if(boost::filesystem::exists(dir)) { boost::filesystem::directory_iterator it(dir), it_end; for(; it != it_end; it++) { if(boost::filesystem::is_directory(it->status())) { - path_files_md5_hash(it->path().string()); + path_files_md5_hash_recursive(hash, it->path().string()); } else { string filepath = it->path().string(); @@ -105,6 +102,14 @@ string path_files_md5_hash(const string& dir) } } } +} + +string path_files_md5_hash(const string& dir) +{ + /* computes md5 hash of all files in the directory */ + MD5Hash hash; + + path_files_md5_hash_recursive(hash, dir); return hash.get_hex(); } |