mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Rewritten vfs_canon_and_translate() function for using glib functions.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
ec1a52fb0a
commit
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)
|
||||
{
|
||||
char buf[MC_MAXPATHLEN];
|
||||
char *ret_str;
|
||||
|
||||
if (path == NULL)
|
||||
return strdup("");
|
||||
return g_strdup("");
|
||||
|
||||
if (path[0] == PATH_SEP)
|
||||
{
|
||||
char cwd[MC_MAXPATHLEN];
|
||||
if (getcwd (cwd, sizeof (cwd)))
|
||||
snprintf (buf, sizeof (buf), "%s" PATH_SEP_STR "%s", cwd, path);
|
||||
else
|
||||
return strdup ("[MC_MAXPATHLEN TOO SMALL]");
|
||||
char *curr_dir = g_get_current_dir();
|
||||
ret_str = g_strdup_printf("%s" PATH_SEP_STR "%s", curr_dir, path);
|
||||
g_free(curr_dir);
|
||||
}
|
||||
else
|
||||
snprintf (buf, sizeof (buf), "%s", path);
|
||||
ret_str = g_strdup(path);
|
||||
|
||||
canonicalize_pathname (buf);
|
||||
return strdup (buf);
|
||||
canonicalize_pathname (ret_str);
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_VFS */
|
||||
|
Loading…
Reference in New Issue
Block a user