From 69d891ab3b6232da75c881296203e3a310f4f100 Mon Sep 17 00:00:00 2001 From: Adrian Ebeling Date: Sun, 20 Jan 2019 14:24:45 +0100 Subject: [PATCH] Fixed building on posix --- src/platform_posix.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/platform_posix.cc b/src/platform_posix.cc index 774f38d9..9709b5d4 100644 --- a/src/platform_posix.cc +++ b/src/platform_posix.cc @@ -35,6 +35,7 @@ limitations under the License. #include // required for stat.h #include #include +#include #ifdef __GLIBC__ #include #endif @@ -134,21 +135,21 @@ void SpawnThread(void *(*fn)(void *), void *arg) { /// callback function required for RemoveDirectoryRecursive() static int nftwCallback(const char *name, const struct stat * /*unused*/, int /*unused*/, FTW * /*unused*/) { - remove(name); - return 0; + remove(name); + return 0; } -void RemoveDirectoryRecursive(const AbsolutePath &path) { - // https://stackoverflow.com/a/5467788/2192139 - nftw(path.path.c_str(), nftwCallback, 64, FTW_DEPTH | FTW_PHYS); +void RemoveDirectoryRecursive(const std::string &path) { + // https://stackoverflow.com/a/5467788/2192139 + nftw(path.c_str(), nftwCallback, 64, FTW_DEPTH | FTW_PHYS); } -optional TryMakeTempDirectory() { - char tmpl[] = "/tmp/ccls-XXXXXX"; - if(!mkdtemp(tmpl)) { - return nullopt; - } - return tmpl; +std::optional TryMakeTempDirectory() { + char tmpl[] = "/tmp/ccls-XXXXXX"; + if(!mkdtemp(tmpl)) { + return std::nullopt; + } + return tmpl; } } // namespace ccls