mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-31 14:30:51 +00:00
Added ability to specify zt home directory via ZEROTIER_HOME - Addresses ticket #829
This commit is contained in:
parent
0fddebc791
commit
3dd9b1aa9b
@ -29,6 +29,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "../node/Constants.hpp"
|
#include "../node/Constants.hpp"
|
||||||
#include "../node/Utils.hpp"
|
#include "../node/Utils.hpp"
|
||||||
@ -398,6 +399,21 @@ std::string OSUtils::platformDefaultHomePath()
|
|||||||
return homeDir;
|
return homeDir;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Check for user-defined environment variable before using defaults
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
DWORD bufferSize = 65535;
|
||||||
|
std::string userDefinedPath;
|
||||||
|
bufferSize = GetEnvironmentVariable("ZEROTIER_HOME", &userDefinedPath[0], bufferSize);
|
||||||
|
if (bufferSize) {
|
||||||
|
return userDefinedPath;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(const char* userDefinedPath = getenv("ZEROTIER_HOME")) {
|
||||||
|
return std::string(userDefinedPath);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Finally, resort to using default paths if no user-defined path was provided
|
||||||
#ifdef __UNIX_LIKE__
|
#ifdef __UNIX_LIKE__
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user