mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-08 01:04:54 +00:00
Fixed building on posix
This commit is contained in:
parent
a57957702e
commit
69d891ab3b
@ -35,6 +35,7 @@ limitations under the License.
|
||||
#include <sys/types.h> // required for stat.h
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <ftw.h>
|
||||
#ifdef __GLIBC__
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@ -138,15 +139,15 @@ static int nftwCallback(const char *name, const struct stat * /*unused*/,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RemoveDirectoryRecursive(const AbsolutePath &path) {
|
||||
void RemoveDirectoryRecursive(const std::string &path) {
|
||||
// https://stackoverflow.com/a/5467788/2192139
|
||||
nftw(path.path.c_str(), nftwCallback, 64, FTW_DEPTH | FTW_PHYS);
|
||||
nftw(path.c_str(), nftwCallback, 64, FTW_DEPTH | FTW_PHYS);
|
||||
}
|
||||
|
||||
optional<std::string> TryMakeTempDirectory() {
|
||||
std::optional<std::string> TryMakeTempDirectory() {
|
||||
char tmpl[] = "/tmp/ccls-XXXXXX";
|
||||
if(!mkdtemp(tmpl)) {
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
return tmpl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user