From 0913e968f59aed413dcb9bc5e392a554e2711ad7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 12 Oct 2014 14:48:19 +0200 Subject: More win32/abc fixes --- kernel/yosys.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'kernel') diff --git a/kernel/yosys.cc b/kernel/yosys.cc index fa14c5d9..e50bfcbe 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -473,12 +473,14 @@ std::string proc_self_dirname() #elif defined(_WIN32) std::string proc_self_dirname() { - char path[MAX_PATH+1]; - if (!GetModuleFileName(0, path, MAX_PATH+1)) + char longpath[MAX_PATH+1], shortpath[MAX_PATH+1]; + if (!GetModuleFileName(0, longpath, MAX_PATH+1)) log_error("GetModuleFileName() failed.\n"); - for (int i = strlen(path)-1; i >= 0 && path[i] != '/' && path[i] != '\\' ; i--) - path[i] = 0; - return std::string(path); + if (!GetShortPathName(longpath, shortpath, MAX_PATH+1)) + log_error("GetShortPathName() failed.\n"); + for (int i = strlen(shortpath)-1; i >= 0 && shortpath[i] != '/' && shortpath[i] != '\\' ; i--) + shortpath[i] = 0; + return std::string(shortpath); } #elif defined(EMSCRIPTEN) std::string proc_self_dirname() -- cgit v1.2.3