mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
Cleanup dylib.c
This commit is contained in:
parent
624a70f062
commit
b39959c985
@ -78,35 +78,36 @@ dylib_t dylib_load(const char *path)
|
|||||||
int prevmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
int prevmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
||||||
#endif
|
#endif
|
||||||
#ifdef __WINRT__
|
#ifdef __WINRT__
|
||||||
|
dylib_t lib;
|
||||||
/* On UWP, you can only load DLLs inside your install directory, using a special function that takes a relative path */
|
/* On UWP, you can only load DLLs inside your install directory, using a special function that takes a relative path */
|
||||||
|
char relative_path_abbrev[PATH_MAX_LENGTH];
|
||||||
|
char *relative_path = relative_path_abbrev;
|
||||||
|
wchar_t *path_wide = NULL;
|
||||||
|
|
||||||
|
relative_path_abbrev[0] = '\0';
|
||||||
|
|
||||||
if (!path_is_absolute(path))
|
if (!path_is_absolute(path))
|
||||||
RARCH_WARN("Relative path in dylib_load! This is likely an attempt to load a system library that will fail\n");
|
RARCH_WARN("Relative path in dylib_load! This is likely an attempt to load a system library that will fail\n");
|
||||||
|
|
||||||
char *relative_path_abbrev = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
fill_pathname_abbreviate_special(relative_path_abbrev, path, sizeof(relative_path_abbrev));
|
||||||
fill_pathname_abbreviate_special(relative_path_abbrev, path, PATH_MAX_LENGTH * sizeof(char));
|
|
||||||
|
|
||||||
char *relative_path = relative_path_abbrev;
|
/* Path to dylib_load is not inside app install directory.
|
||||||
if (relative_path[0] != ':' || !PATH_CHAR_IS_SLASH(relative_path[1]))
|
* Loading will probably fail. */
|
||||||
{
|
if (relative_path[0] != ':' || !PATH_CHAR_IS_SLASH(relative_path[1])) { }
|
||||||
/* Path to dylib_load is not inside app install directory.
|
|
||||||
* Loading will probably fail. */
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
relative_path += 2;
|
relative_path += 2;
|
||||||
|
|
||||||
|
path_wide = utf8_to_utf16_string_alloc(relative_path);
|
||||||
wchar_t *pathW = utf8_to_utf16_string_alloc(relative_path);
|
lib = LoadPackagedLibrary(path_wide, 0);
|
||||||
dylib_t lib = LoadPackagedLibrary(pathW, 0);
|
free(path_wide);
|
||||||
free(pathW);
|
|
||||||
|
|
||||||
free(relative_path_abbrev);
|
free(relative_path_abbrev);
|
||||||
#elif defined(LEGACY_WIN32)
|
#elif defined(LEGACY_WIN32)
|
||||||
dylib_t lib = LoadLibrary(path);
|
dylib_t lib = LoadLibrary(path);
|
||||||
#else
|
#else
|
||||||
wchar_t *pathW = utf8_to_utf16_string_alloc(path);
|
wchar_t *path_wide = utf8_to_utf16_string_alloc(path);
|
||||||
dylib_t lib = LoadLibraryW(pathW);
|
dylib_t lib = LoadLibraryW(path_wide);
|
||||||
free(pathW);
|
free(path_wide);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __WINRT__
|
#ifndef __WINRT__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user