From e646979ad908ff8fdeeafd9a19d1365643da5cf4 Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 16 Jul 2017 10:13:29 +0200 Subject: [PATCH] GetLongPathName is not available on mingw32, resolve it dynamically --- libr/util/file.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libr/util/file.c b/libr/util/file.c index bcde064e4d..140af223b7 100644 --- a/libr/util/file.c +++ b/libr/util/file.c @@ -9,6 +9,7 @@ #include #include #include +#include #if __UNIX__ #include #endif @@ -873,8 +874,11 @@ R_API char *r_file_tmpdir() { path = strdup ("C:\\WINDOWS\\Temp\\"); } } else { - // Windows XP sometimes returns short path name - GetLongPathName (tmpdir, tmpdir, sizeof (tmpdir)); + void (*glpn)(TCHAR *, TCHAR *, size_t) = (void*)r_lib_dl_sym (NULL, "GetLongPathName"); + if (glpn) { + // Windows XP sometimes returns short path name + glpn (tmpdir, tmpdir, sizeof (tmpdir)); + } path = strdup (tmpdir); } #elif __ANDROID__