diff --git a/core/debugadapter.cpp b/core/debugadapter.cpp index 2390f183..f835a964 100644 --- a/core/debugadapter.cpp +++ b/core/debugadapter.cpp @@ -16,12 +16,10 @@ limitations under the License. #include #include +#include #include #include #include -#ifndef WIN32 - #include "libgen.h" -#endif #include "debugadapter.h" #include "debuggercontroller.h" @@ -80,7 +78,8 @@ std::string DebugModule::GetPathBaseName(const std::string& path) _splitpath_s(path.c_str(), NULL, 0, NULL, 0, baseName, MAX_PATH, ext, MAX_PATH); return std::string(baseName) + std::string(ext); #else - return basename(strdup(path.c_str())); + std::filesystem::path fs_path(path); + return fs_path.stem(); #endif } diff --git a/core/debuggercommon.h b/core/debuggercommon.h index 85a99362..70e08f51 100644 --- a/core/debuggercommon.h +++ b/core/debuggercommon.h @@ -15,11 +15,12 @@ limitations under the License. */ #pragma once +#include +#include #include #include -#ifndef WIN32 - #include "libgen.h" -#endif +#include +#include namespace BinaryNinjaDebugger { struct ModuleNameAndOffset @@ -63,7 +64,8 @@ namespace BinaryNinjaDebugger { _splitpath_s(path.c_str(), NULL, 0, NULL, 0, baseName, MAX_PATH, ext, MAX_PATH); return std::string(baseName) + std::string(ext); #else - return basename(strdup(path.c_str())); + std::filesystem::path fs_path(path); + return fs_path.stem(); #endif }