made sure the windows version actually compiled

This commit is contained in:
jacob1 2018-04-23 22:32:03 -04:00
parent 601af1feff
commit de757bc2c3
4 changed files with 14 additions and 11 deletions

View File

@ -77,7 +77,7 @@ void DoRestart()
if (exename.length())
{
#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)
execl(exename.c_str(), "powder", NULL);
#endif

View File

@ -23,6 +23,7 @@
#include "Update.h"
#include "Platform.h"
// returns 1 on failure, 0 on success
int update_start(char *data, unsigned int len)
{
std::string exeName = Platform::ExecutableName(), updName;
@ -39,23 +40,23 @@ int update_start(char *data, unsigned int len)
updName = updName + "_upd.exe";
if (!MoveFile(exeName.c_str(), updName.c_str()))
goto fail;
return 1;
f = fopen(exeName.c_str(), "wb");
if (!f)
goto fail;
return 1;
if (fwrite(data, 1, len, f) != len)
{
fclose(f);
DeleteFile(exeName.c_str());
goto fail;
return 1;
}
fclose(f);
if ((uintptr_t)ShellExecute(NULL, "open", exeName.c_str(), NULL, NULL, SW_SHOWNORMAL) <= 32)
{
DeleteFile(exeName.c_str());
goto fail;
return 1;
}
return 0;
@ -90,7 +91,8 @@ int update_start(char *data, unsigned int len)
#endif
}
int update_finish(void)
// returns 1 on failure, 0 on success
int update_finish()
{
#ifdef WIN
std::string exeName = Platform::ExecutableName(), updName;
@ -141,7 +143,7 @@ int update_finish(void)
return 0;
}
void update_cleanup(void)
void update_cleanup()
{
#ifdef WIN
update_finish();

View File

@ -3,7 +3,7 @@
//char *exe_name(void);
int update_start(char *data, unsigned int len);
int update_finish(void);
void update_cleanup(void);
int update_finish();
void update_cleanup();
#endif /* UPDATE_H_ */

View File

@ -183,7 +183,9 @@ bool Client::DoInstallation()
int returnval;
LONG rresult;
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 *opencommand = NULL;
char *protocolcommand = NULL;
@ -342,7 +344,6 @@ bool Client::DoInstallation()
free(iconname);
free(opencommand);
free(protocolcommand);
free(currentfilename);
return returnval;
#elif defined(LIN)