mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 20:38:44 +00:00
Added proc_self_dirname() for win32
This commit is contained in:
parent
e8c66ee36b
commit
568fee5e74
|
@ -28,6 +28,10 @@
|
|||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
@ -334,8 +338,12 @@ std::string proc_self_dirname()
|
|||
#elif defined(_WIN32)
|
||||
std::string proc_self_dirname()
|
||||
{
|
||||
#warning Fixme: Implement proc_self_dirname() for win32.
|
||||
log_error("proc_self_dirname() is not implemented for win32 yet!\n");
|
||||
char path[MAX_PATH+1];
|
||||
if (!GetModuleFileName(0, path, 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);
|
||||
}
|
||||
#elif defined(EMSCRIPTEN)
|
||||
std::string proc_self_dirname()
|
||||
|
|
Loading…
Reference in a new issue