mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
fixed relative symlink operations. Symlink now stay relative
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
ea4078e52e
commit
12af8e5db0
@ -265,7 +265,7 @@ mc_symlink (const char *name1, const char *path)
|
||||
if (vpath1 == NULL)
|
||||
return -1;
|
||||
|
||||
vpath2 = vfs_path_from_str (name1);
|
||||
vpath2 = vfs_path_from_str_flags (name1, VPF_NO_CANON);
|
||||
|
||||
if (vpath2 != NULL)
|
||||
{
|
||||
|
@ -607,15 +607,16 @@ vfs_path_to_str (const vfs_path_t * vpath)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Split path string to path elements.
|
||||
* Split path string to path elements with flags for change parce process.
|
||||
*
|
||||
* @param path_str VFS-path
|
||||
* @param flags flags for parser
|
||||
*
|
||||
* @return pointer to newly created vfs_path_t object with filled path elements array.
|
||||
*/
|
||||
|
||||
vfs_path_t *
|
||||
vfs_path_from_str (const char *path_str)
|
||||
vfs_path_from_str_flags (const char *path_str, vfs_path_flag_t flags)
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
char *path;
|
||||
@ -623,7 +624,11 @@ vfs_path_from_str (const char *path_str)
|
||||
if (path_str == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((flags & VPF_NO_CANON) == 0)
|
||||
path = vfs_canon (path_str);
|
||||
else
|
||||
path = g_strdup (path_str);
|
||||
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -637,6 +642,21 @@ vfs_path_from_str (const char *path_str)
|
||||
return vpath;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Split path string to path elements.
|
||||
*
|
||||
* @param path_str VFS-path
|
||||
*
|
||||
* @return pointer to newly created vfs_path_t object with filled path elements array.
|
||||
*/
|
||||
|
||||
vfs_path_t *
|
||||
vfs_path_from_str (const char *path_str)
|
||||
{
|
||||
return vfs_path_from_str_flags (path_str, VPF_NONE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*
|
||||
* Create new vfs_path_t object.
|
||||
|
@ -7,6 +7,12 @@
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VPF_NONE = 0,
|
||||
VPF_NO_CANON = 1
|
||||
} vfs_path_flag_t;
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
||||
struct vfs_class;
|
||||
@ -48,6 +54,7 @@ int vfs_path_elements_count (const vfs_path_t * path);
|
||||
char *vfs_path_to_str (const vfs_path_t * path);
|
||||
char *vfs_path_to_str_elements_count (const vfs_path_t * path, int elements_count);
|
||||
vfs_path_t *vfs_path_from_str (const char *path_str);
|
||||
vfs_path_t *vfs_path_from_str_flags (const char *path_str, vfs_path_flag_t flags);
|
||||
|
||||
vfs_path_element_t *vfs_path_get_by_index (const vfs_path_t * path, int element_index);
|
||||
vfs_path_element_t *vfs_path_element_clone (const vfs_path_element_t * element);
|
||||
|
Loading…
Reference in New Issue
Block a user