mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-21 22:07:49 +00:00
Builds on Windows now.
This commit is contained in:
parent
4d1cca1150
commit
a5896264fa
@ -182,7 +182,6 @@ void SoftwareUpdater::_cbHandleGetLatestVersionBinary(void *arg,int code,const s
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
size_t lastSlash = url.rfind('/');
|
||||
if (lastSlash == std::string::npos) { // sanity check, shouldn't happen
|
||||
LOG("software update aborted: invalid URL");
|
||||
@ -191,30 +190,36 @@ void SoftwareUpdater::_cbHandleGetLatestVersionBinary(void *arg,int code,const s
|
||||
}
|
||||
std::string updatesDir(_r->homePath + ZT_PATH_SEPARATOR_S + "updates.d");
|
||||
std::string updatePath(updatesDir + ZT_PATH_SEPARATOR_S + url.substr(lastSlash + 1));
|
||||
#ifdef __WINDOWS__
|
||||
CreateDirectoryA(updatesDir.c_str(),NULL);
|
||||
#else
|
||||
mkdir(updatesDir.c_str(),0755);
|
||||
#endif
|
||||
|
||||
int fd = ::open(updatePath.c_str(),O_WRONLY|O_CREAT|O_TRUNC,0755);
|
||||
if (fd <= 0) {
|
||||
FILE *upf = fopen(updatePath.c_str(),"wb");
|
||||
if (!upf) {
|
||||
LOG("software update aborted: unable to open %s for writing",updatePath.c_str());
|
||||
upd->_status = UPDATE_STATUS_IDLE;
|
||||
return;
|
||||
}
|
||||
if ((long)::write(fd,body.data(),body.length()) != (long)body.length()) {
|
||||
if (fwrite(body.data(),body.length(),1,upf) != 1) {
|
||||
LOG("software update aborted: unable to write to %s",updatePath.c_str());
|
||||
upd->_status = UPDATE_STATUS_IDLE;
|
||||
fclose(upf);
|
||||
Utils::rm(updatePath);
|
||||
return;
|
||||
}
|
||||
::close(fd);
|
||||
fclose(upf);
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
::chmod(updatePath.c_str(),0755);
|
||||
#endif
|
||||
|
||||
// We exit with this reason code and the path as the text. It is the
|
||||
// caller's responsibility (main.c) to pick this up and do the right
|
||||
// thing.
|
||||
upd->_status = UPDATE_STATUS_IDLE;
|
||||
|
||||
_r->node->terminate(Node::NODE_RESTART_FOR_UPGRADE,updatePath.c_str());
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
todo;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
@ -19,6 +19,8 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\ext\lz4\lz4.h" />
|
||||
<ClInclude Include="..\..\ext\lz4\lz4hc.h" />
|
||||
<ClInclude Include="..\..\node\Address.hpp" />
|
||||
<ClInclude Include="..\..\node\Array.hpp" />
|
||||
<ClInclude Include="..\..\node\AtomicCounter.hpp" />
|
||||
@ -64,6 +66,8 @@
|
||||
<ClInclude Include="..\..\node\Utils.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\ext\lz4\lz4.c" />
|
||||
<ClCompile Include="..\..\ext\lz4\lz4hc.c" />
|
||||
<ClCompile Include="..\..\node\C25519.cpp" />
|
||||
<ClCompile Include="..\..\node\CertificateOfMembership.cpp" />
|
||||
<ClCompile Include="..\..\node\Defaults.cpp" />
|
||||
@ -168,7 +172,7 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>$(SolutionDir)\ext\bin\libcrypto\win32-vs2012\libeay32.lib;wsock32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@ -183,7 +187,7 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>$(SolutionDir)\ext\bin\libcrypto\win32-vs2012\libeay32.lib;wsock32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@ -202,7 +206,7 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;iphlpapi.lib;$(SolutionDir)\ext\bin\libcrypto\win32-vs2012\libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@ -222,7 +226,7 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;iphlpapi.lib;$(SolutionDir)\ext\bin\libcrypto\win64-vs2012\libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
@ -140,6 +140,12 @@
|
||||
<ClInclude Include="..\..\node\Utils.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\ext\lz4\lz4.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\ext\lz4\lz4hc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\node\C25519.cpp">
|
||||
@ -226,5 +232,11 @@
|
||||
<ClCompile Include="..\..\selftest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ext\lz4\lz4.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ext\lz4\lz4hc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user