file_path_special.c - cleanup

This commit is contained in:
twinaphex 2015-09-22 21:49:03 +02:00
parent df13e6a1fd
commit 0f202cad8e

View File

@ -26,26 +26,16 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#ifdef __HAIKU__
#include <kernel/image.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <direct.h> #include <direct.h>
#else #else
#include <unistd.h> /* stat() is defined here */ #include <unistd.h>
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#endif #endif
#if defined(__CELLOS_LV2__)
#ifndef S_ISDIR
#define S_ISDIR(x) (x & 0040000)
#endif
#endif
#include <file/file_path.h> #include <file/file_path.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
@ -131,8 +121,8 @@ void fill_pathname_abbreviate_special(char *out_path,
rarch_assert(src_size < size); rarch_assert(src_size < size);
out_path += src_size; out_path += src_size;
size -= src_size; size -= src_size;
in_path += strlen(candidates[i]); in_path += strlen(candidates[i]);
if (!path_char_is_slash(*in_path)) if (!path_char_is_slash(*in_path))
{ {
@ -193,7 +183,7 @@ void fill_pathname_application_path(char *buf, size_t size)
char link_path[PATH_MAX_LENGTH] = {0}; char link_path[PATH_MAX_LENGTH] = {0};
*buf = '\0'; *buf = '\0';
pid = getpid(); pid = getpid();
/* Linux, BSD and Solaris paths. Not standardized. */ /* Linux, BSD and Solaris paths. Not standardized. */
for (i = 0; i < ARRAY_SIZE(exts); i++) for (i = 0; i < ARRAY_SIZE(exts); i++)
@ -203,6 +193,7 @@ void fill_pathname_application_path(char *buf, size_t size)
snprintf(link_path, sizeof(link_path), "/proc/%u/%s", snprintf(link_path, sizeof(link_path), "/proc/%u/%s",
(unsigned)pid, exts[i]); (unsigned)pid, exts[i]);
ret = readlink(link_path, buf, size - 1); ret = readlink(link_path, buf, size - 1);
if (ret >= 0) if (ret >= 0)
{ {
buf[ret] = '\0'; buf[ret] = '\0';