mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-18 15:18:17 +00:00
Fix -h in zerotier-cli and move code to find auth token into LocalClient, also move auth token for mac into Mac-standard Library/Application Support location.
This commit is contained in:
@ -188,6 +188,32 @@ std::vector<std::string> Node::LocalClient::splitLine(const char *line)
|
||||
return Utils::split(line," ","\\","\"");
|
||||
}
|
||||
|
||||
std::string Node::LocalClient::authTokenDefaultUserPath()
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
if (home) {
|
||||
#ifdef __APPLE__
|
||||
return (std::string(home) + "/Library/Application Support/ZeroTier/One/authtoken.secret");
|
||||
#else
|
||||
return (std::string(home) + "/.zeroTierOneAuthToken");
|
||||
#endif
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
struct _NodeImpl
|
||||
{
|
||||
RuntimeEnvironment renv;
|
||||
|
Reference in New Issue
Block a user