mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-31 03:51:02 -07:00
Windows build fixes and installer work...
This commit is contained in:
parent
3375363d93
commit
6bc5a84a2d
12 changed files with 6345 additions and 119 deletions
|
@ -36,6 +36,7 @@
|
|||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <ShlObj.h>
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
|
@ -78,24 +79,25 @@ static inline std::map< Identity,std::vector<InetAddress> > _mkSupernodeMap()
|
|||
static inline std::string _mkDefaultHomePath()
|
||||
{
|
||||
#ifdef __UNIX_LIKE__
|
||||
|
||||
#ifdef __APPLE__
|
||||
return std::string("/Library/Application Support/ZeroTier/One");
|
||||
#else
|
||||
return std::string("/var/lib/zerotier-one");
|
||||
#endif
|
||||
#else
|
||||
|
||||
#else // not __UNIX_LIKE__
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
OSVERSIONINFO vi;
|
||||
memset (&vi,0,sizeof(vi));
|
||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
||||
GetVersionEx(&vi);
|
||||
if (vi.dwMajorVersion < 6)
|
||||
return std::string("C:\\Documents and Settings\\All Users\\Application Data\\ZeroTier\\One");
|
||||
return std::string("C:\\ProgramData\\ZeroTier\\One");
|
||||
char buf[16384];
|
||||
if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_COMMON_APPDATA,NULL,0,buf)))
|
||||
return (std::string(buf) + "\\ZeroTier\\One");
|
||||
else return std::string("C:\\ZeroTier\\One");
|
||||
#else
|
||||
// unknown platform
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // __UNIX_LIKE__ or not...
|
||||
}
|
||||
|
||||
static inline std::map< Address,Identity > _mkUpdateAuth()
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <ShlObj.h>
|
||||
#endif
|
||||
|
||||
#include "Condition.hpp"
|
||||
|
@ -190,6 +191,15 @@ std::vector<std::string> 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue