mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-18 15:18:17 +00:00
Generalize unlink to OS-dep code in Utils, just a little prep for Windows port.
This commit is contained in:
@ -43,6 +43,12 @@
|
||||
#include "../ext/lz4/lz4.h"
|
||||
#include "../ext/lz4/lz4hc.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "Constants.hpp"
|
||||
|
||||
/**
|
||||
@ -58,6 +64,27 @@ namespace ZeroTier {
|
||||
class Utils
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Delete a file
|
||||
*
|
||||
* @param path Path to delete
|
||||
* @return True if delete was successful
|
||||
*/
|
||||
static inline bool rm(const char *path)
|
||||
throw()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
foo;
|
||||
#else
|
||||
return (unlink(path) == 0);
|
||||
#endif
|
||||
}
|
||||
static inline bool rm(const std::string &path)
|
||||
throw()
|
||||
{
|
||||
return rm(path.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* List a directory's contents
|
||||
*
|
||||
|
Reference in New Issue
Block a user