From: James Turner Date: Wed, 4 May 2016 21:13:15 +0000 (+0100) Subject: Avoid unlink of an open file. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e6713af4d8a1d9fd4de1c55319ffe69d0a0a90e8;p=simgear.git Avoid unlink of an open file. Works on Unix, not so great on Windows it turns out. Thanks to Jasin and Geoff for figuring this out in the end. --- diff --git a/simgear/io/SVNDirectory.cxx b/simgear/io/SVNDirectory.cxx index a4ef9bc5..267d3120 100644 --- a/simgear/io/SVNDirectory.cxx +++ b/simgear/io/SVNDirectory.cxx @@ -136,7 +136,7 @@ void SVNDirectory::parseCache() _cachedRevision = versionName; doneSelf = true; } else { - DAVResource* child = addChildDirectory(hrefPtr)->collection(); + DAVResource* child = parseChildDirectory(hrefPtr)->collection(); string s = strutils::strip(versionName); if (!s.empty()) { child->setVersionName(versionName); @@ -235,6 +235,17 @@ SVNDirectory::addChildDirectory(const std::string& dirName) return child; } +SVNDirectory* +SVNDirectory::parseChildDirectory(const std::string& dirName) +{ + assert(!dav->childWithName(dirName)); + DAVCollection* childCol = dav->createChildCollection(dirName); + SVNDirectory* child = new SVNDirectory(this, childCol); + childCol->setVersionName(child->cachedRevision()); + _children.push_back(child); + return child; +} + void SVNDirectory::deleteChildByName(const std::string& nm) { DAVResource* child = dav->childWithName(nm); diff --git a/simgear/io/SVNDirectory.hxx b/simgear/io/SVNDirectory.hxx index 68bca1b0..1d7122cc 100644 --- a/simgear/io/SVNDirectory.hxx +++ b/simgear/io/SVNDirectory.hxx @@ -91,7 +91,8 @@ private: void writeCache(); DirectoryList::iterator findChildDir(const std::string& dirName); - + SVNDirectory* parseChildDirectory(const std::string& dirName); + SGPath localPath; DAVCollection* dav; SVNRepository* repo;