]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/tools/quickbook/src/dependency_tracker.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / quickbook / src / dependency_tracker.cpp
index 12b2a757a9266165ae8c242a7c02baa43587c7dd..787452ee44c85f64d555fc3e7bf0236b63644c7b 100644 (file)
@@ -7,56 +7,13 @@
 =============================================================================*/
 
 #include "dependency_tracker.hpp"
-#include "native_text.hpp"
+#include "path.hpp"
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/fstream.hpp>
 #include <boost/foreach.hpp>
 
 namespace quickbook
 {
-    // Convert the path to its canonical representation if it exists.
-    // Or something close if it doesn't.
-    static fs::path normalize_path(fs::path const& path)
-    {
-        fs::path p = fs::absolute(path); // The base of the path.
-        fs::path extra; // The non-existant part of the path.
-        int parent_count = 0; // Number of active '..' sections
-
-        // Invariant: path is equivalent to: p / ('..' * parent_count) / extra
-        // i.e. if parent_count == 0: p/extra
-        // if parent_count == 2: p/../../extra
-
-        // Pop path sections from path until we find an existing
-        // path, adjusting for any dot path sections.
-        while (!fs::exists(fs::status(p))) {
-            fs::path name = p.filename();
-            p = p.parent_path();
-            if (name == "..") {
-                ++parent_count;
-            }
-            else if (name == ".") {
-            }
-            else if (parent_count) {
-                --parent_count;
-            }
-            else {
-                extra = name / extra;
-            }
-        }
-
-        // If there are any left over ".." sections, then add them
-        // on to the end of the real path, and trust Boost.Filesystem
-        // to sort them out.
-        while (parent_count) {
-            p = p / "..";
-            --parent_count;
-        }
-
-        // Cannoicalize the existing part of the path, and add 'extra' back to
-        // the end.
-        return fs::canonical(p) / extra;
-    }
-
     static char const* control_escapes[16] = {
         "\\000", "\\001", "\\002", "\\003",
         "\\004", "\\005", "\\006", "\\a",
@@ -106,19 +63,19 @@ namespace quickbook
 
     bool dependency_tracker::add_dependency(fs::path const& f) {
         bool found = fs::exists(fs::status(f));
-        dependencies[normalize_path(f)] |= found;
+        dependencies[f] |= found;
         return found;
     }
 
     void dependency_tracker::add_glob(fs::path const& f) {
         std::pair<glob_list::iterator, bool> r = glob_dependencies.insert(
-                std::make_pair(normalize_path(f), glob_list::mapped_type()));
+                std::make_pair(f, glob_list::mapped_type()));
         last_glob = r.first;
     }
 
     void dependency_tracker::add_glob_match(fs::path const& f) {
         assert(last_glob != glob_dependencies.end());
-        last_glob->second.insert(normalize_path(f));
+        last_glob->second.insert(f);
     }
 
     void dependency_tracker::write_dependencies(fs::path const& file_out,