Rewritten vfs_canon_and_translate() function for using glib functions.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
родитель
ec1a52fb0a
Коммит
c73e282823
18
vfs/vfs.h
18
vfs/vfs.h
@ -58,24 +58,22 @@ static inline char *vfs_translate_path_n (const char *path)
|
|||||||
|
|
||||||
static inline char* vfs_canon_and_translate(const char* path)
|
static inline char* vfs_canon_and_translate(const char* path)
|
||||||
{
|
{
|
||||||
char buf[MC_MAXPATHLEN];
|
char *ret_str;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return strdup("");
|
return g_strdup("");
|
||||||
|
|
||||||
if (path[0] == PATH_SEP)
|
if (path[0] == PATH_SEP)
|
||||||
{
|
{
|
||||||
char cwd[MC_MAXPATHLEN];
|
char *curr_dir = g_get_current_dir();
|
||||||
if (getcwd (cwd, sizeof (cwd)))
|
ret_str = g_strdup_printf("%s" PATH_SEP_STR "%s", curr_dir, path);
|
||||||
snprintf (buf, sizeof (buf), "%s" PATH_SEP_STR "%s", cwd, path);
|
g_free(curr_dir);
|
||||||
else
|
|
||||||
return strdup ("[MC_MAXPATHLEN TOO SMALL]");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
snprintf (buf, sizeof (buf), "%s", path);
|
ret_str = g_strdup(path);
|
||||||
|
|
||||||
canonicalize_pathname (buf);
|
canonicalize_pathname (ret_str);
|
||||||
return strdup (buf);
|
return ret_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ENABLE_VFS */
|
#endif /* ENABLE_VFS */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user