osdep/ compile fixes, and remove some lingering OS-specific stuff from node/Defaults

This commit is contained in:
Adam Ierymenko 2015-04-08 19:03:30 -07:00
parent d761330465
commit 7192fe6d15
14 changed files with 110 additions and 140 deletions

View file

@ -51,6 +51,40 @@
namespace ZeroTier {
static inline std::string _mkDefaultHomePath()
{
#ifdef __UNIX_LIKE__
#ifdef __APPLE__
// /Library/... on Apple
return std::string("/Library/Application Support/ZeroTier/One");
#else
#ifdef __FreeBSD__
// FreeBSD likes /var/db instead of /var/lib
return std::string("/var/db/zerotier-one");
#else
// Use /var/lib for Linux and other *nix
return std::string("/var/lib/zerotier-one");
#endif
#endif
#else // not __UNIX_LIKE__
#ifdef __WINDOWS__
// Look up app data folder on Windows, e.g. C:\ProgramData\...
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
#error Unknown platform, please define a default home path!
#endif
#endif // __UNIX_LIKE__ or not...
}
#ifdef __UNIX_LIKE__
bool OSUtils::redirectUnixOutputs(const char *stdoutPath,const char *stderrPath)
throw()