mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 12:41:00 +00:00
Small tweaks to fill_pathname_application_path (#17268)
This commit is contained in:
parent
4521f6bcb2
commit
2650712cb3
@ -1369,7 +1369,7 @@ void path_basedir_wrapper(char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||||
void fill_pathname_application_path(char *s, size_t len)
|
size_t fill_pathname_application_path(char *s, size_t len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -1386,7 +1386,7 @@ void fill_pathname_application_path(char *s, size_t len)
|
|||||||
(void)i;
|
(void)i;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#ifdef LEGACY_WIN32
|
#ifdef LEGACY_WIN32
|
||||||
@ -1406,9 +1406,11 @@ void fill_pathname_application_path(char *s, size_t len)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
s[ret] = '\0';
|
s[ret] = '\0';
|
||||||
|
return ret;
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
if (bundle)
|
if (bundle)
|
||||||
{
|
{
|
||||||
|
size_t rv = 0;
|
||||||
CFURLRef bundle_url = CFBundleCopyBundleURL(bundle);
|
CFURLRef bundle_url = CFBundleCopyBundleURL(bundle);
|
||||||
CFStringRef bundle_path = CFURLCopyPath(bundle_url);
|
CFStringRef bundle_path = CFURLCopyPath(bundle_url);
|
||||||
CFStringGetCString(bundle_path, s, len, kCFStringEncodingUTF8);
|
CFStringGetCString(bundle_path, s, len, kCFStringEncodingUTF8);
|
||||||
@ -1423,35 +1425,35 @@ void fill_pathname_application_path(char *s, size_t len)
|
|||||||
size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1);
|
size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1);
|
||||||
s[ _len] = '/';
|
s[ _len] = '/';
|
||||||
s[++_len] = '\0';
|
s[++_len] = '\0';
|
||||||
|
rv = _len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
rv = CFStringGetLength(bundle_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CFRelease(bundle_path);
|
CFRelease(bundle_path);
|
||||||
CFRelease(bundle_url);
|
CFRelease(bundle_url);
|
||||||
#ifndef HAVE_COCOATOUCH
|
return rv;
|
||||||
/* Not sure what this does but it breaks
|
|
||||||
* stuff for iOS, so skipping */
|
|
||||||
strlcat(s, "nobin", len);
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
#elif defined(__HAIKU__)
|
#elif defined(__HAIKU__)
|
||||||
while (get_next_image_info(0, &cookie, &info) == B_OK)
|
while (get_next_image_info(0, &cookie, &info) == B_OK)
|
||||||
{
|
{
|
||||||
if (info.type == B_APP_IMAGE)
|
if (info.type == B_APP_IMAGE)
|
||||||
{
|
{
|
||||||
strlcpy(s, info.name, len);
|
return strlcpy(s, info.name, len);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(__QNX__)
|
#elif defined(__QNX__)
|
||||||
char *buff = malloc(len);
|
char *buff = malloc(len);
|
||||||
|
size_t rv = 0;
|
||||||
|
|
||||||
if (_cmdname(buff))
|
if (_cmdname(buff))
|
||||||
strlcpy(s, buff, len);
|
rv = strlcpy(s, buff, len);
|
||||||
|
|
||||||
free(buff);
|
free(buff);
|
||||||
|
return rv;
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
static const char *exts[] = { "exe", "file", "path/a.out" };
|
static const char *exts[] = { "exe", "file", "path/a.out" };
|
||||||
@ -1471,9 +1473,10 @@ void fill_pathname_application_path(char *s, size_t len)
|
|||||||
if ((ret = readlink(link_path, s, len - 1)) >= 0)
|
if ((ret = readlink(link_path, s, len - 1)) >= 0)
|
||||||
{
|
{
|
||||||
s[ret] = '\0';
|
s[ret] = '\0';
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -642,7 +642,7 @@ void path_basedir_wrapper(char *path);
|
|||||||
size_t fill_pathname_slash(char *path, size_t size);
|
size_t fill_pathname_slash(char *path, size_t size);
|
||||||
|
|
||||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||||
void fill_pathname_application_path(char *buf, size_t size);
|
size_t fill_pathname_application_path(char *buf, size_t size);
|
||||||
void fill_pathname_application_dir(char *buf, size_t size);
|
void fill_pathname_application_dir(char *buf, size_t size);
|
||||||
size_t fill_pathname_home_dir(char *buf, size_t size);
|
size_t fill_pathname_home_dir(char *buf, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user