1
1

VFS: added non-vfs version of vfs_canon_and_translate()

Этот коммит содержится в:
Enrico Weigelt, metux IT service 2009-12-29 06:08:29 +01:00 коммит произвёл Slava Zanko
родитель b3a0216000
Коммит 43fa57ed65

Просмотреть файл

@ -10,6 +10,7 @@
#include <sys/types.h>
#include <dirent.h>
#include <utime.h>
#include <stdio.h>
#ifdef USE_VFS
@ -55,6 +56,28 @@ static inline char *vfs_translate_path_n (const char *path)
return ((path == NULL) ? g_strdup ("") : g_strdup (path));
}
static inline char* vfs_canon_and_translate(const char* path)
{
char buf[MC_MAXPATHLEN];
if (path == NULL)
return 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]");
}
else
snprintf (buf, sizeof (buf), "%s", path);
canonicalize_pathname (buf);
return strdup (buf);
}
#endif /* USE_VFS */
char *vfs_strip_suffix_from_filename (const char *filename);