26 #include <boost/filesystem/operations.hpp>
27 #include <boost/filesystem/path.hpp>
28 #include <boost/version.hpp>
35 #include "fife_boost_filesystem.h"
41 #define BOOST_MAJOR_VERSION BOOST_VERSION / 100000
42 #define BOOST_MINOR_VERSION BOOST_VERSION / 100 % 1000
44 #if (BOOST_MAJOR_VERSION >= 1 && BOOST_MINOR_VERSION >= 44 && defined(BOOST_FILESYSTEM_VERSION))
45 #if (BOOST_FILESYSTEM_VERSION == 2)
49 #define USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2
50 #elif (BOOST_FILESYSTEM_VERSION == 3)
54 #define USE_BOOST_FILESYSTEM_V3
56 #elif (BOOST_MAJOR_VERSION >= 1 && BOOST_MINOR_VERSION >= 46)
60 #define USE_BOOST_FILESYSTEM_V3
61 #elif (BOOST_MAJOR_VERSION >= 1 && BOOST_MINOR_VERSION >= 36)
65 #define USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2
72 #if defined(USE_BOOST_FILESYSTEM_V3) || defined(USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2)
73 return path.has_parent_path();
75 return path.has_branch_path();
80 #if defined(USE_BOOST_FILESYSTEM_V3) || defined(USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2)
81 return path.parent_path();
83 return path.branch_path();
88 #if defined(USE_BOOST_FILESYSTEM_V3)
93 return path.filename().string();
94 #elif defined(USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2)
98 return path.filename();
108 bfs::directory_iterator badIter;
111 if (iter == badIter) {
115 #if defined(USE_BOOST_FILESYSTEM_V3)
120 return iter->path().filename().string();
121 #elif defined(USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2)
125 return iter->path().filename();
136 #if defined(USE_BOOST_FILESYSTEM_V3)
141 return (*pathIter).string();
155 #if defined(USE_BOOST_FILESYSTEM_V3)
156 return bfs::absolute(path);
158 return bfs::complete(path);
176 if (extension.empty() || extension ==
".") {
189 #if defined(USE_BOOST_FILESYSTEM_V3)
190 return path.extension().string();
192 return bfs::extension(path);
197 return GetStem(bfs::path(path));
201 #if defined(USE_BOOST_FILESYSTEM_V3)
207 return path.stem().string();
std::string GetFilenameFromPath(const bfs::path &path)
std::string GetFilenameFromDirectoryIterator(const bfs::directory_iterator &iter)
bool HasParentPath(const bfs::path &path)
bfs::path GetParentPath(const bfs::path &path)
std::string GetPathIteratorAsString(const bfs::path::iterator &pathIter)
bfs::path GetAbsolutePath(const std::string &path)
bool HasExtension(const std::string &path)
std::string GetStem(const std::string &path)
std::string GetExtension(const std::string &path)
credit to phoku for his NodeDisplay example which the visitor code is adapted from ( he coded the qua...