1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-14 13:09:14 +00:00

Changed to set the binary directory to the current working directory.

This commit is contained in:
nodchip 2020-07-20 17:17:50 +09:00
parent 77018c77cc
commit fbdb373b64

View file

@ -20,6 +20,15 @@
#include <iostream> #include <iostream>
#ifdef _WIN32
#include <filesystem>
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Windows.h>
#endif
#include "bitboard.h" #include "bitboard.h"
#include "endgame.h" #include "endgame.h"
#include "position.h" #include "position.h"
@ -34,6 +43,17 @@ namespace PSQT {
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
// Change the current working directory to the binary directory. So that a
// net file path can be specified with a relative path from the binary
// directory.
// TODO(someone): Implement the logic for other OS.
#ifdef _WIN32
TCHAR filename[_MAX_PATH];
::GetModuleFileName(NULL, filename, sizeof(filename) / sizeof(filename[0]));
std::filesystem::path current_path = filename;
current_path.remove_filename();
std::filesystem::current_path(current_path);
#endif
std::cout << engine_info() << std::endl; std::cout << engine_info() << std::endl;