fixes for extraction log

This commit is contained in:
Tim Felgentreff 2021-06-13 17:06:52 +02:00
parent db86d82886
commit 7c8ba8def0
2 changed files with 25 additions and 21 deletions

View file

@ -185,26 +185,6 @@ stratagus-game-launcher.h - Stratagus Game Launcher
#include "stratagus-gameutils.h"
#ifdef WIN32
char* GetExtractionLogPath(char* data_path) {
static char *marker = (char*)calloc(MAX_PATH, sizeof(char));
if (marker[0] != '\0') {
return marker;
}
if (PathCombine(marker, data_path, "portable-install")) {
if (PathFileExists(marker)) {
PathCombine(marker, data_path, "data-extraction.log");
return marker;
}
}
SHGetFolderPathA(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, marker);
PathAppend(marker, "Stratagus");
mkdir_p(marker);
PathAppend(marker, GAME_NAME "-extraction.log")
return marker;
}
#endif
static void SetUserDataPath(char* data_path) {
#if defined(WIN32)
char marker[MAX_PATH] = {'\0'};
@ -772,7 +752,7 @@ int main(int argc, char * argv[]) {
#endif
"Try also to remove the folder %s and try the extraction again.",
#ifdef WIN32
GetExtractionLogPath(data_path),
GetExtractionLogPath(GAME_NAME, data_path),
#endif
data_path);
error(TITLE, message);

View file

@ -218,4 +218,28 @@ void copy_dir(const char* src_path, const char* dst_path) {
}
#endif
#ifdef WIN32
char* GetExtractionLogPath(const char* game_name, char* data_path) {
static char *marker = (char*)calloc(MAX_PATH, sizeof(char));
if (marker[0] != '\0') {
return marker;
}
if (PathCombine(marker, data_path, "portable-install")) {
if (PathFileExists(marker)) {
PathCombine(marker, data_path, "data-extraction.log");
return marker;
}
}
SHGetFolderPathA(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, marker);
PathAppend(marker, "Stratagus");
mkdir_p(marker);
char logname[MAX_PATH];
strcpy(logname, game_name);
strcat(logname, "-extraction.log");
PathAppend(marker, logname);
return marker;
}
#endif
#endif