Mercurial > minori
comparison src/core/filesystem.cc @ 404:e561b7542b7b
*: fix build on mac os x
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 19 Jan 2026 20:50:40 -0500 |
| parents | d859306e2db4 |
| children | 31ce85df55a8 |
comparison
equal
deleted
inserted
replaced
| 403:df4a027623d0 | 404:e561b7542b7b |
|---|---|
| 3 #include "core/strings.h" | 3 #include "core/strings.h" |
| 4 | 4 |
| 5 #include <QStandardPaths> | 5 #include <QStandardPaths> |
| 6 | 6 |
| 7 #include <filesystem> | 7 #include <filesystem> |
| 8 #include <unordered_map> | |
| 8 | 9 |
| 9 #ifdef WIN32 | 10 #ifdef WIN32 |
| 10 # include <windows.h> | 11 # include <windows.h> |
| 11 #elif defined(HAVE_INOTIFY) | 12 #elif defined(HAVE_INOTIFY) |
| 12 /* ehhhh */ | 13 /* ehhhh */ |
| 98 completely stops. I am dumbfounded at this behavior, but | 99 completely stops. I am dumbfounded at this behavior, but |
| 99 nevertheless it means we simply can't use it, and must | 100 nevertheless it means we simply can't use it, and must |
| 100 resort to old-fashioned recursion. --paper | 101 resort to old-fashioned recursion. --paper |
| 101 */ | 102 */ |
| 102 static void IterateDirectory(const std::filesystem::path &path, bool recursive, | 103 static void IterateDirectory(const std::filesystem::path &path, bool recursive, |
| 103 std::function<void(const std::filesystem::path &path)> func) | 104 const std::function<void(const std::filesystem::path &path)> &func) |
| 104 { | 105 { |
| 105 std::error_code ec; | 106 std::error_code ec; |
| 106 static const std::filesystem::directory_iterator end; | 107 static const std::filesystem::directory_iterator end; |
| 107 | 108 |
| 108 for (std::filesystem::directory_iterator item(path, ec); item != end; item.increment(ec)) { | 109 for (std::filesystem::directory_iterator item(path, ec); item != end; item.increment(ec)) { |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 } | 181 } |
| 181 | 182 |
| 182 /* unordered hashmap, path[found] */ | 183 /* unordered hashmap, path[found] */ |
| 183 std::unordered_map<std::filesystem::path, bool> paths_; | 184 PathMap<bool> paths_; |
| 184 bool recursive_; | 185 bool recursive_; |
| 185 }; | 186 }; |
| 186 | 187 |
| 187 /* There does actually exist an API in Qt to do file system watching. | 188 /* There does actually exist an API in Qt to do file system watching. |
| 188 * However, it is of little use for us, since it | 189 * However, it is of little use for us, since it |
