Merge branch '2874_tilde_directory' into 4.8.1-stable

* 2874_tilde_directory:
  Allow create directory with name '~' (tilda).
  Reimplement support of use ~ as home directory in hotlist.
  Ticket #2874: enter on directory named '~' goes to the home one.
This commit is contained in:
Andrew Borodin 2012-09-06 10:33:31 +04:00
commit 92a0edd15f
3 changed files with 18 additions and 16 deletions

View File

@ -152,16 +152,11 @@ vfs_canon (const char *path)
}
else
{
local = tilde_expand (path);
if (*local != PATH_SEP)
{
char *curr_dir;
char *curr_dir;
g_free (local);
curr_dir = vfs_get_current_dir ();
local = mc_build_filename (curr_dir, path, NULL);
g_free (curr_dir);
}
curr_dir = vfs_get_current_dir ();
local = mc_build_filename (curr_dir, path, NULL);
g_free (curr_dir);
}
result = vfs_canon (local);
g_free (local);

View File

@ -952,16 +952,23 @@ mkdir_cmd (void)
input_expand_dialog (_("Create a new Directory"),
_("Enter directory name:"), MC_HISTORY_FM_MKDIR, name);
if (!dir)
return;
if (*dir)
if (dir != NULL && dir != '\0')
{
vfs_path_t *absdir;
if (dir[0] == '/' || dir[0] == '~')
absdir = vfs_path_from_str (dir);
else
absdir = vfs_path_append_new (current_panel->cwd_vpath, dir, NULL);
{
/* possible escaped '~' */
/* allow create directory with name '~' */
char *tmpdir = dir;
if (dir[0] == '\\' && dir[1] == '~')
tmpdir = dir + 1;
absdir = vfs_path_append_new (current_panel->cwd_vpath, tmpdir, NULL);
}
save_cwds_stat ();
if (my_mkdir (absdir, 0777) == 0)

View File

@ -1436,7 +1436,7 @@ hot_load_group (struct hotlist *grp)
label = g_strdup (tkn_buf->str);
CHECK_TOKEN (TKN_URL);
CHECK_TOKEN (TKN_STRING);
url = g_strdup (tkn_buf->str);
url = tilde_expand (tkn_buf->str);
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
SKIP_TO_EOL;
}
@ -1490,7 +1490,7 @@ hot_load_file (struct hotlist *grp)
label = g_strdup (tkn_buf->str);
CHECK_TOKEN (TKN_URL);
CHECK_TOKEN (TKN_STRING);
url = g_strdup (tkn_buf->str);
url = tilde_expand (tkn_buf->str);
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
SKIP_TO_EOL;
}