diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-06-27 11:32:07 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-06-27 11:32:07 -0700 |
commit | 8a99113c880e13cb86b2a070135761c8637c275f (patch) | |
tree | d79ed67aebff863eb346fa33bc89e0c4dd112b87 /osdep | |
parent | 2225bb093ae57099c04ff3eabc020468920be11a (diff) | |
parent | c61440efea086ab5c9acb515604aac34d84b13cb (diff) | |
download | infinitytier-8a99113c880e13cb86b2a070135761c8637c275f.tar.gz infinitytier-8a99113c880e13cb86b2a070135761c8637c275f.zip |
Merge branch 'dev' of http://10.6.6.2/zerotier/ZeroTierOne into dev
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/OSUtils.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/osdep/OSUtils.cpp b/osdep/OSUtils.cpp index 53e8bb97..ac9452e1 100644 --- a/osdep/OSUtils.cpp +++ b/osdep/OSUtils.cpp @@ -363,6 +363,24 @@ std::vector<std::string> OSUtils::split(const char *s,const char *const sep,cons std::string OSUtils::platformDefaultHomePath() { +#ifdef __QNAP__ + char *cmd = "/sbin/getcfg ZeroTier Install_Path -f /etc/config/qpkg.conf"; + char buf[128]; + FILE *fp; + if ((fp = popen(cmd, "r")) == NULL) { + printf("Error opening pipe!\n"); + return NULL; + } + while (fgets(buf, 128, fp) != NULL) { } + if(pclose(fp)) { + printf("Command not found or exited with error status\n"); + return NULL; + } + std::string homeDir = std::string(buf); + homeDir.erase(std::remove(homeDir.begin(), homeDir.end(), '\n'), homeDir.end()); + return homeDir; +#endif + #ifdef __UNIX_LIKE__ #ifdef __APPLE__ |