Start get executable path for windows

This commit is contained in:
Eero Holmala 2023-11-08 22:51:55 +02:00
parent 9e618872d5
commit 3ace3ad7dd
2 changed files with 17 additions and 1 deletions

View File

@ -4,6 +4,7 @@
"filesystem": "cpp",
"chrono": "cpp",
"vector": "cpp",
"iostream": "cpp"
"iostream": "cpp",
"fstream": "cpp"
}
}

View File

@ -4,6 +4,8 @@
#include <string>
#include <chrono>
#include <vector>
#include <windows.h>
#include <libloaderapi.h>
#include <nlohmann/json.hpp>
@ -18,6 +20,12 @@ enum Flags {
EMPTY_DIRECTORIES = 0x2
};
// DWORD GetModuleFileNameA(
// [in, optional] HMODULE hModule,
// [out] LPSTR lpFilename,
// [in] DWORD nSize
// );
struct DirectoryEntry
{
std::filesystem::path path;
@ -50,6 +58,13 @@ print_usage()
bool
createDefaultConfig()
{
LPSTR lpFilename;
DWORD nSize = 256;
DWORD len;
len = GetModuleFileName(NULL, lpFilename, nSize);
OutputDebugString(lpFilename);
json config;
config["version"] = getVersion();
config["directories"][0]["directory"] = "C:/dev/temp";