Mercurial > minori
comparison dep/animia/src/fd/linux.cc @ 163:44c5e6dd9488
dep/animia/osx: move GetProcessName to util/osx so we can use it in quartz
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Sat, 18 Nov 2023 00:47:40 -0500 |
| parents | cdf79282d647 |
| children | 99fdf5a90b0f |
comparison
equal
deleted
inserted
replaced
| 162:61b76c7b656a | 163:44c5e6dd9488 |
|---|---|
| 20 | 20 |
| 21 namespace animia::internal::linux { | 21 namespace animia::internal::linux { |
| 22 | 22 |
| 23 /* this uses dirent instead of std::filesystem; it would make a bit | 23 /* this uses dirent instead of std::filesystem; it would make a bit |
| 24 more sense to use the latter, but this is platform dependent already :) */ | 24 more sense to use the latter, but this is platform dependent already :) */ |
| 25 std::vector<std::string> GetAllFilesInDir(const std::string& _dir) { | 25 static std::vector<std::string> GetAllFilesInDir(const std::string& _dir) { |
| 26 std::vector<std::string> ret; | 26 std::vector<std::string> ret; |
| 27 | 27 |
| 28 DIR* dir = opendir(_dir.c_str()); | 28 DIR* dir = opendir(_dir.c_str()); |
| 29 if (!dir) | 29 if (!dir) |
| 30 return ret; | 30 return ret; |
| 37 | 37 |
| 38 closedir(dir); | 38 closedir(dir); |
| 39 return ret; | 39 return ret; |
| 40 } | 40 } |
| 41 | 41 |
| 42 std::string Basename(const std::string& path) { | 42 static std::string Basename(const std::string& path) { |
| 43 return path.substr(path.find_last_of("/") + 1, path.length()); | 43 return path.substr(path.find_last_of("/") + 1, path.length()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 static bool IsRegularFile(std::string link) { | 46 static bool IsRegularFile(std::string link) { |
| 47 struct stat sb; | 47 struct stat sb; |
