compile and run in windows (improvements needed)

This commit is contained in:
Ondrej Novak 2025-02-08 09:19:55 +01:00
parent f55f92a88b
commit f70b29abab
83 changed files with 415 additions and 3747 deletions

View file

@ -1,23 +1,22 @@
#include "../platform.h"
#include "../save_folder.h"
#include "../error.h"
#include <iostream>
#include <filesystem>
#include <windows.h>
#include <ShlObj.h>
#pragma comment(lib, "shell32.lib")
#pragma comment(lib, "ole32.lib")
// Pro získání uživatelské složky
namespace fs = std::filesystem;
// Funkce pro získání složky "Saved Games"
std::string getSavedGamesDirectory() {
PWSTR path = nullptr;
// Použití identifikátoru složky FOLDERID_SavedGames
if (SUCCEEDED(SHGetKnownFolderPathA(FOLDERID_SavedGames, 0, NULL, &path))) {
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_SavedGames, 0, NULL, &path))) {
fs::path savedGamesPath(path);
CoTaskMemFree(path); // Uvolnění paměti
return savedGamesPath / SAVEGAME_FOLDERNAME
CoTaskMemFree(path);
return (savedGamesPath / SAVEGAME_FOLDERNAME).string();
} else {
display_error("Failed to retrieve FOLDEROD_SavedGames");
abort();
@ -25,7 +24,7 @@ std::string getSavedGamesDirectory() {
}
const char *get_default_savegame_directory() {
static std::string dir = get_default_savgetSavedGamesDirectoryegame_dir();
static std::string dir = getSavedGamesDirectory();
return dir.c_str();
}