Fixed extensions loading on Windows (#21355)
This commit is contained in:
parent
39ba1ed03f
commit
d553d4cd55
@ -95,7 +95,7 @@ std::wstring string_to_wstring(const std::string& str);
|
||||
|
||||
/// \brief Remove path components which would allow traversing up a directory tree.
|
||||
/// \param path A path to file
|
||||
/// \return A sanitiazed path
|
||||
/// \return A sanitized path
|
||||
std::string sanitize_path(const std::string& path);
|
||||
|
||||
/// \brief Returns the name with extension for a given path
|
||||
|
@ -92,15 +92,7 @@ std::shared_ptr<void> load_shared_object(const char* path) {
|
||||
IEGetDllDirectoryA(nBufferLength, &lpBuffer.front());
|
||||
|
||||
// GetDirname
|
||||
auto dirname = [path] {
|
||||
auto pos = strchr(path, '\\');
|
||||
if (pos == nullptr) {
|
||||
return std::string{path};
|
||||
}
|
||||
std::string original(path);
|
||||
original[pos - path] = 0;
|
||||
return original;
|
||||
}();
|
||||
auto dirname = get_directory(path);
|
||||
|
||||
SetDllDirectoryA(dirname.c_str());
|
||||
shared_object = LoadLibraryA(path);
|
||||
|
Loading…
Reference in New Issue
Block a user