From 6bc5a84a2d6caa90aa131a705b93c88586b2a95f Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 20 Jan 2014 16:16:01 -0800 Subject: Windows build fixes and installer work... --- node/Node.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'node/Node.cpp') diff --git a/node/Node.cpp b/node/Node.cpp index 627042b3..9bfa7ad6 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -44,6 +44,7 @@ #ifdef __WINDOWS__ #include #include +#include #endif #include "Condition.hpp" @@ -190,6 +191,15 @@ std::vector Node::LocalClient::splitLine(const char *line) std::string Node::LocalClient::authTokenDefaultUserPath() { +#ifdef __WINDOWS__ + + char buf[16384]; + if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_APPDATA,NULL,0,buf))) + return (std::string(buf) + "\\ZeroTier\\One\\authtoken.secret"); + else return std::string(); + +#else // not __WINDOWS__ + const char *home = getenv("HOME"); if (home) { #ifdef __APPLE__ @@ -197,21 +207,14 @@ std::string Node::LocalClient::authTokenDefaultUserPath() #else return (std::string(home) + "/.zeroTierOneAuthToken"); #endif - } - return std::string(); + } else return std::string(); + +#endif // __WINDOWS__ or not __WINDOWS__ } std::string Node::LocalClient::authTokenDefaultSystemPath() { -#ifdef __WINDOWS__ - // TODO -#else -#ifdef __APPLE__ - return "/Library/Application Support/ZeroTier/One/authtoken.secret"; -#else - return "/var/lib/zerotier-one/authtoken.secret"; -#endif -#endif + return (ZT_DEFAULTS.defaultHomePath + ZT_PATH_SEPARATOR_S"authtoken.secret"); } struct _NodeImpl -- cgit v1.2.3