don't use _update in update filename because of windows "feature"
This commit is contained in:
parent
01741b05ce
commit
96de9bbc36
@ -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;
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user