Permalink
Browse files

made sure the windows version actually compiled

  • Loading branch information...
jacob1 committed Apr 24, 2018
1 parent 601af1f commit de757bc2c3afce1ab2f0cca592ca378da8493de7
Showing with 14 additions and 11 deletions.
  1. +1 −1 src/Platform.cpp
  2. +8 −6 src/Update.cpp
  3. +2 −2 src/Update.h
  4. +3 −2 src/client/Client.cpp
@@ -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
@@ -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();
@@ -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_ */
@@ -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)

0 comments on commit de757bc

Please sign in to comment.