diff options
| author | Grant Limberg <grant.limberg@zerotier.com> | 2018-09-25 10:19:59 -0700 |
|---|---|---|
| committer | Grant Limberg <grant.limberg@zerotier.com> | 2018-09-25 10:19:59 -0700 |
| commit | 0510f85a8fe6cba7e6258d534fa49d47f9f8e2a2 (patch) | |
| tree | ef9bf53e9dd472a1fb343a41a41630bb30097979 /osdep/OSUtils.cpp | |
| parent | 5b222d0a09dab1a7e009f728f955a0ef70d569a6 (diff) | |
| parent | 27c37a18f3e2f97d06ebc04e2db31d0c796c9452 (diff) | |
| download | infinitytier-0510f85a8fe6cba7e6258d534fa49d47f9f8e2a2.tar.gz infinitytier-0510f85a8fe6cba7e6258d534fa49d47f9f8e2a2.zip | |
Merge branch 'dev' into libpq
Diffstat (limited to 'osdep/OSUtils.cpp')
| -rw-r--r-- | osdep/OSUtils.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/osdep/OSUtils.cpp b/osdep/OSUtils.cpp index cadd4e6b..1e704d45 100644 --- a/osdep/OSUtils.cpp +++ b/osdep/OSUtils.cpp @@ -29,6 +29,7 @@ #include <stdlib.h> #include <stdarg.h> #include <sys/stat.h> +#include <stdlib.h> #include "../node/Constants.hpp" #include "../node/Utils.hpp" @@ -366,7 +367,7 @@ std::vector<std::string> OSUtils::split(const char *s,const char *const sep,cons if (buf.size() > 0) { fields.push_back(buf); buf.clear(); - } // else skip runs of seperators + } // else skip runs of separators } else buf.push_back(*s); } ++s; @@ -398,6 +399,25 @@ std::string OSUtils::platformDefaultHomePath() return homeDir; #endif +#ifdef __SYNOLOGY__ + return std::string("/var/packages/zerotier/target/var"); +#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 __APPLE__ |
