mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Merge pull request #12459 from toshixm/fix_12103
Fix garbled path string
This commit is contained in:
commit
375eb4b852
@ -650,16 +650,31 @@ bool path_is_absolute(const char *path)
|
|||||||
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
|
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
|
||||||
{
|
{
|
||||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||||
char tmp[PATH_MAX_LENGTH];
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
strlcpy(tmp, buf, sizeof(tmp));
|
char *ret = NULL;
|
||||||
if (!_fullpath(buf, tmp, size))
|
wchar_t abs_path[PATH_MAX_LENGTH];
|
||||||
|
wchar_t *rel_path = utf8_to_utf16_string_alloc(buf);
|
||||||
|
|
||||||
|
if (rel_path)
|
||||||
{
|
{
|
||||||
strlcpy(buf, tmp, size);
|
if (_wfullpath(abs_path, rel_path, PATH_MAX_LENGTH))
|
||||||
return NULL;
|
{
|
||||||
|
char *tmp = utf16_to_utf8_string_alloc(abs_path);
|
||||||
|
|
||||||
|
if (tmp)
|
||||||
|
{
|
||||||
|
strlcpy(buf, tmp, size);
|
||||||
|
free(tmp);
|
||||||
|
ret = buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(rel_path);
|
||||||
}
|
}
|
||||||
return buf;
|
|
||||||
|
return ret;
|
||||||
#else
|
#else
|
||||||
|
char tmp[PATH_MAX_LENGTH];
|
||||||
size_t t;
|
size_t t;
|
||||||
char *p;
|
char *p;
|
||||||
const char *next;
|
const char *next;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user