Allow create directory with name '~' (tilda).

Use escaping for that (as in shell): \~.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-09-01 14:38:41 +04:00
parent 85ed2bd331
commit 513d30e5a1

View File

@ -895,16 +895,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)