mirror of
https://github.com/libretro/RetroArch
synced 2025-04-23 02:42:24 +00:00
Cleanups
This commit is contained in:
parent
7829b3153c
commit
a3349dc364
@ -520,7 +520,7 @@ bool path_is_absolute(const char *path)
|
|||||||
void path_resolve_realpath(char *buf, size_t size)
|
void path_resolve_realpath(char *buf, size_t size)
|
||||||
{
|
{
|
||||||
#ifndef RARCH_CONSOLE
|
#ifndef RARCH_CONSOLE
|
||||||
char tmp[PATH_MAX_LENGTH] = {0};
|
char tmp[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
strlcpy(tmp, buf, sizeof(tmp));
|
strlcpy(tmp, buf, sizeof(tmp));
|
||||||
|
|
||||||
@ -537,10 +537,6 @@ void path_resolve_realpath(char *buf, size_t size)
|
|||||||
if (!realpath(tmp, buf))
|
if (!realpath(tmp, buf))
|
||||||
strlcpy(buf, tmp, size);
|
strlcpy(buf, tmp, size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
(void)buf;
|
|
||||||
(void)size;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,13 +629,14 @@ void fill_pathname_resolve_relative(char *out_path,
|
|||||||
const char *in_refpath, const char *in_path, size_t size)
|
const char *in_refpath, const char *in_path, size_t size)
|
||||||
{
|
{
|
||||||
if (path_is_absolute(in_path))
|
if (path_is_absolute(in_path))
|
||||||
rarch_assert(strlcpy(out_path, in_path, size) < size);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
rarch_assert(strlcpy(out_path, in_refpath, size) < size);
|
rarch_assert(strlcpy(out_path, in_path, size) < size);
|
||||||
path_basedir(out_path);
|
return;
|
||||||
rarch_assert(strlcat(out_path, in_path, size) < size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rarch_assert(strlcpy(out_path, in_refpath, size) < size);
|
||||||
|
path_basedir(out_path);
|
||||||
|
rarch_assert(strlcat(out_path, in_path, size) < size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -712,18 +709,18 @@ void fill_short_pathname_representation(char* out_rep,
|
|||||||
sizeof(path_short));
|
sizeof(path_short));
|
||||||
|
|
||||||
last_hash = (char*)strchr(path_short,'#');
|
last_hash = (char*)strchr(path_short,'#');
|
||||||
/* We handle paths like:
|
|
||||||
* /path/to/file.7z#mygame.img
|
|
||||||
* short_name: mygame.img:
|
|
||||||
*/
|
|
||||||
if(last_hash != NULL)
|
if(last_hash != NULL)
|
||||||
{
|
{
|
||||||
/* We check whether something is actually
|
/* We handle paths like:
|
||||||
|
* /path/to/file.7z#mygame.img
|
||||||
|
* short_name: mygame.img:
|
||||||
|
*
|
||||||
|
* We check whether something is actually
|
||||||
* after the hash to avoid going over the buffer.
|
* after the hash to avoid going over the buffer.
|
||||||
*/
|
*/
|
||||||
rarch_assert(strlen(last_hash) > 1);
|
rarch_assert(strlen(last_hash) > 1);
|
||||||
strlcpy(out_rep,last_hash + 1, size);
|
strlcpy(out_rep, last_hash + 1, size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strlcpy(out_rep,path_short, size);
|
strlcpy(out_rep, path_short, size);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user