Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
don't use _update in update filename because of windows "feature"
  • Loading branch information
jacob1 committed Mar 14, 2018
1 parent 01741b0 commit 96de9bb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Update.cpp
Expand Up @@ -41,7 +41,7 @@ int update_start(char *data, unsigned int len)
p = temp + strlen(temp) - 4;
if (_stricmp(p, ".exe"))
p += 4;
strcpy(p, "_update.exe");
strcpy(p, "_upd.exe");

if (!MoveFile(self, temp))
goto fail;
Expand Down Expand Up @@ -105,7 +105,7 @@ int update_finish(void)
{
#ifdef WIN
char *temp, *self = Platform::ExecutableName(), *p;
int timeout = 60, err;
int timeout = 5, err;

#ifdef DEBUG
printf("Update: Current EXE name: %s\n", self);
Expand All @@ -116,7 +116,7 @@ int update_finish(void)
p = temp + strlen(temp) - 4;
if (_stricmp(p, ".exe"))
p += 4;
strcpy(p, "_update.exe");
strcpy(p, "_upd.exe");

#ifdef DEBUG
printf("Update: Temp EXE name: %s\n", temp);
Expand All @@ -128,9 +128,17 @@ int update_finish(void)
if (err == ERROR_FILE_NOT_FOUND)
{
#ifdef DEBUG
printf("Update: Temp file deleted\n");
printf("Update: Temp file deleted\n");
#endif
free(temp);
// Old versions of powder toy name their update files with _update.exe, delete that upgrade file here
temp = (char*)malloc(strlen(self)+12);
strcpy(temp, self);
p = temp + strlen(temp) - 4;
if (_stricmp(p, ".exe"))
p += 4;
strcpy(p, "_update.exe");
DeleteFile(temp);
return 0;
}
Sleep(500);
Expand Down

0 comments on commit 96de9bb

Please sign in to comment.