mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-11 19:04:05 +02:00
made sure the windows version actually compiled
This commit is contained in:
@@ -77,7 +77,7 @@ void DoRestart()
|
|||||||
if (exename.length())
|
if (exename.length())
|
||||||
{
|
{
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
ShellExecute(NULL, "open", exename, NULL, NULL, SW_SHOWNORMAL);
|
ShellExecute(NULL, "open", exename.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||||
#elif defined(LIN) || defined(MACOSX)
|
#elif defined(LIN) || defined(MACOSX)
|
||||||
execl(exename.c_str(), "powder", NULL);
|
execl(exename.c_str(), "powder", NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include "Update.h"
|
#include "Update.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
|
// returns 1 on failure, 0 on success
|
||||||
int update_start(char *data, unsigned int len)
|
int update_start(char *data, unsigned int len)
|
||||||
{
|
{
|
||||||
std::string exeName = Platform::ExecutableName(), updName;
|
std::string exeName = Platform::ExecutableName(), updName;
|
||||||
@@ -39,23 +40,23 @@ int update_start(char *data, unsigned int len)
|
|||||||
updName = updName + "_upd.exe";
|
updName = updName + "_upd.exe";
|
||||||
|
|
||||||
if (!MoveFile(exeName.c_str(), updName.c_str()))
|
if (!MoveFile(exeName.c_str(), updName.c_str()))
|
||||||
goto fail;
|
return 1;
|
||||||
|
|
||||||
f = fopen(exeName.c_str(), "wb");
|
f = fopen(exeName.c_str(), "wb");
|
||||||
if (!f)
|
if (!f)
|
||||||
goto fail;
|
return 1;
|
||||||
if (fwrite(data, 1, len, f) != len)
|
if (fwrite(data, 1, len, f) != len)
|
||||||
{
|
{
|
||||||
fclose(f);
|
fclose(f);
|
||||||
DeleteFile(exeName.c_str());
|
DeleteFile(exeName.c_str());
|
||||||
goto fail;
|
return 1;
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
if ((uintptr_t)ShellExecute(NULL, "open", exeName.c_str(), NULL, NULL, SW_SHOWNORMAL) <= 32)
|
if ((uintptr_t)ShellExecute(NULL, "open", exeName.c_str(), NULL, NULL, SW_SHOWNORMAL) <= 32)
|
||||||
{
|
{
|
||||||
DeleteFile(exeName.c_str());
|
DeleteFile(exeName.c_str());
|
||||||
goto fail;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -90,7 +91,8 @@ int update_start(char *data, unsigned int len)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int update_finish(void)
|
// returns 1 on failure, 0 on success
|
||||||
|
int update_finish()
|
||||||
{
|
{
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
std::string exeName = Platform::ExecutableName(), updName;
|
std::string exeName = Platform::ExecutableName(), updName;
|
||||||
@@ -141,7 +143,7 @@ int update_finish(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_cleanup(void)
|
void update_cleanup()
|
||||||
{
|
{
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
update_finish();
|
update_finish();
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
//char *exe_name(void);
|
//char *exe_name(void);
|
||||||
int update_start(char *data, unsigned int len);
|
int update_start(char *data, unsigned int len);
|
||||||
int update_finish(void);
|
int update_finish();
|
||||||
void update_cleanup(void);
|
void update_cleanup();
|
||||||
|
|
||||||
#endif /* UPDATE_H_ */
|
#endif /* UPDATE_H_ */
|
||||||
|
@@ -183,7 +183,9 @@ bool Client::DoInstallation()
|
|||||||
int returnval;
|
int returnval;
|
||||||
LONG rresult;
|
LONG rresult;
|
||||||
HKEY newkey;
|
HKEY newkey;
|
||||||
char *currentfilename = Platform::ExecutableName();
|
std::string currentfilename2 = Platform::ExecutableName();
|
||||||
|
// this isn't necessary but I don't feel like c++ifying this code right now
|
||||||
|
const char *currentfilename = currentfilename2.c_str();
|
||||||
char *iconname = NULL;
|
char *iconname = NULL;
|
||||||
char *opencommand = NULL;
|
char *opencommand = NULL;
|
||||||
char *protocolcommand = NULL;
|
char *protocolcommand = NULL;
|
||||||
@@ -342,7 +344,6 @@ bool Client::DoInstallation()
|
|||||||
free(iconname);
|
free(iconname);
|
||||||
free(opencommand);
|
free(opencommand);
|
||||||
free(protocolcommand);
|
free(protocolcommand);
|
||||||
free(currentfilename);
|
|
||||||
|
|
||||||
return returnval;
|
return returnval;
|
||||||
#elif defined(LIN)
|
#elif defined(LIN)
|
||||||
|
Reference in New Issue
Block a user