Skip to content

Commit

Permalink
v2.1.1: Removed auto-updater on non-Mac/Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed Oct 17, 2019
1 parent 66d25c7 commit ec74fdc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CraftOS-PC 2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<None Include="DOCUMENTATION.md" />
<None Include="Info.plist" />
<None Include="LICENSE" />
<None Include="Makefile" />
<None Include="Makefile.in" />
<None Include="packages.config" />
<None Include="README.md" />
<None Include="src\platform_macapp.mm">
Expand Down
6 changes: 3 additions & 3 deletions CraftOS-PC 2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
<None Include="CraftOSTest.lua">
<Filter>Resource Files</Filter>
</None>
<None Include="Makefile">
<Filter>Resource Files</Filter>
</None>
<None Include="src\platform_macapp.mm">
<Filter>Source Files</Filter>
</None>
Expand All @@ -40,6 +37,9 @@
<None Include="Info.plist">
<Filter>Resource Files</Filter>
</None>
<None Include="Makefile.in">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\Ccblink.ico">
Expand Down
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void update_thread() {
parser.parse(session.receiveResponse(response));
Poco::JSON::Object::Ptr root = parser.asVar().extract<Poco::JSON::Object::Ptr>();
if (root->getValue<std::string>("tag_name") != CRAFTOSPC_VERSION) {
#if defined(__APPLE__) || defined(WIN32)
SDL_MessageBoxData msg;
SDL_MessageBoxButtonData buttons[] = {
{0, 0, "Skip This Version"},
Expand Down Expand Up @@ -83,6 +84,9 @@ void update_thread() {
// this should never happen
exit(choice);
}
#else
queueTask([](void* arg)->void* {SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Update available!", (const char*)arg, NULL); return NULL; }, (void*)(std::string("A new update to CraftOS-PC is available (") + root->getValue<std::string>("tag_name") + ", you have " CRAFTOSPC_VERSION "). Go to " + root->getValue<std::string>("html_url") + " to download the new version.").c_str());
#endif
}
} catch (std::exception &e) {
printf("Could not check for updates: %s\n", e.what());
Expand Down
4 changes: 1 addition & 3 deletions src/platform_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ void pushHostString(lua_State *L) {
}

void updateNow(std::string tag_name) {
int * i = new int;
*i = system("pkexec apt update; pkexec apt upgrade craftos-pc");
delete i; // to silence warnings

}

#endif // __INTELLISENSE__

0 comments on commit ec74fdc

Please sign in to comment.