mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
Add DIR_IS_DOT and DIR_IS_DOTDOT macros
...to detect "." and ".." directories, respectively. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
1d52364b52
commit
ab3f53fbbe
3
lib/fs.h
3
lib/fs.h
@ -74,6 +74,9 @@
|
|||||||
|
|
||||||
#define MC_MAXFILENAMELEN MAXNAMLEN
|
#define MC_MAXFILENAMELEN MAXNAMLEN
|
||||||
|
|
||||||
|
#define DIR_IS_DOT(x) ((x)[0] == '.' && (x)[1] == '\0')
|
||||||
|
#define DIR_IS_DOTDOT(x) ((x)[0] == '.' && (x)[1] == '.' && (x)[2] == '\0')
|
||||||
|
|
||||||
/*** enums ***************************************************************************************/
|
/*** enums ***************************************************************************************/
|
||||||
|
|
||||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||||
|
@ -800,7 +800,7 @@ vfs_parse_ls_lga (const char *p, struct stat * s, char **filename, char **linkna
|
|||||||
if (num_spaces != NULL)
|
if (num_spaces != NULL)
|
||||||
{
|
{
|
||||||
*num_spaces = column_ptr[idx] - column_ptr[idx - 1] - strlen (columns[idx - 1]);
|
*num_spaces = column_ptr[idx] - column_ptr[idx - 1] - strlen (columns[idx - 1]);
|
||||||
if (strcmp (columns[idx], "..") == 0)
|
if (DIR_IS_DOTDOT (columns[idx]))
|
||||||
vfs_parce_ls_final_num_spaces = *num_spaces;
|
vfs_parce_ls_final_num_spaces = *num_spaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ filename_completion_function (const char *text, int state, input_complete_t flag
|
|||||||
All entries except "." and ".." match. */
|
All entries except "." and ".." match. */
|
||||||
if (filename_len == 0)
|
if (filename_len == 0)
|
||||||
{
|
{
|
||||||
if (!strcmp (entry->d_name, ".") || !strcmp (entry->d_name, ".."))
|
if (DIR_IS_DOT (entry->d_name) || DIR_IS_DOTDOT (entry->d_name))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -266,7 +266,7 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
|
|||||||
|
|
||||||
for (i = 0; i < current_panel->count; i++)
|
for (i = 0; i < current_panel->count; i++)
|
||||||
{
|
{
|
||||||
if (strcmp (current_panel->dir.list[i].fname, "..") == 0)
|
if (DIR_IS_DOTDOT (current_panel->dir.list[i].fname))
|
||||||
continue;
|
continue;
|
||||||
if (S_ISDIR (current_panel->dir.list[i].st.st_mode) && files_only != 0)
|
if (S_ISDIR (current_panel->dir.list[i].st.st_mode) && files_only != 0)
|
||||||
continue;
|
continue;
|
||||||
@ -941,7 +941,7 @@ mkdir_cmd (void)
|
|||||||
const char *name = "";
|
const char *name = "";
|
||||||
|
|
||||||
/* If 'on' then automatically fills name with current selected item name */
|
/* If 'on' then automatically fills name with current selected item name */
|
||||||
if (auto_fill_mkdir_name && strcmp (selection (current_panel)->fname, "..") != 0)
|
if (auto_fill_mkdir_name && !DIR_IS_DOTDOT (selection (current_panel)->fname))
|
||||||
name = selection (current_panel)->fname;
|
name = selection (current_panel)->fname;
|
||||||
|
|
||||||
dir =
|
dir =
|
||||||
@ -1607,7 +1607,7 @@ smart_dirsize_cmd (void)
|
|||||||
file_entry *entry;
|
file_entry *entry;
|
||||||
|
|
||||||
entry = &(panel->dir.list[panel->selected]);
|
entry = &(panel->dir.list[panel->selected]);
|
||||||
if ((S_ISDIR (entry->st.st_mode) && (strcmp (entry->fname, "..") == 0)) || panel->dirs_marked)
|
if ((S_ISDIR (entry->st.st_mode) && DIR_IS_DOTDOT (entry->fname)) || panel->dirs_marked)
|
||||||
dirsizes_cmd ();
|
dirsizes_cmd ();
|
||||||
else
|
else
|
||||||
single_dirsize_cmd ();
|
single_dirsize_cmd ();
|
||||||
@ -1622,7 +1622,7 @@ single_dirsize_cmd (void)
|
|||||||
file_entry *entry;
|
file_entry *entry;
|
||||||
|
|
||||||
entry = &(panel->dir.list[panel->selected]);
|
entry = &(panel->dir.list[panel->selected]);
|
||||||
if (S_ISDIR (entry->st.st_mode) && strcmp (entry->fname, "..") != 0)
|
if (S_ISDIR (entry->st.st_mode) && !DIR_IS_DOTDOT (entry->fname))
|
||||||
{
|
{
|
||||||
size_t marked = 0;
|
size_t marked = 0;
|
||||||
uintmax_t total = 0;
|
uintmax_t total = 0;
|
||||||
@ -1668,7 +1668,7 @@ dirsizes_cmd (void)
|
|||||||
for (i = 0; i < panel->count; i++)
|
for (i = 0; i < panel->count; i++)
|
||||||
if (S_ISDIR (panel->dir.list[i].st.st_mode)
|
if (S_ISDIR (panel->dir.list[i].st.st_mode)
|
||||||
&& ((panel->dirs_marked && panel->dir.list[i].f.marked)
|
&& ((panel->dirs_marked && panel->dir.list[i].f.marked)
|
||||||
|| !panel->dirs_marked) && strcmp (panel->dir.list[i].fname, "..") != 0)
|
|| !panel->dirs_marked) && !DIR_IS_DOTDOT (panel->dir.list[i].fname))
|
||||||
{
|
{
|
||||||
vfs_path_t *p;
|
vfs_path_t *p;
|
||||||
size_t marked = 0;
|
size_t marked = 0;
|
||||||
|
@ -400,7 +400,7 @@ do_cd_command (char *orig_cmd)
|
|||||||
{
|
{
|
||||||
sync_tree (mc_config_get_home_dir ());
|
sync_tree (mc_config_get_home_dir ());
|
||||||
}
|
}
|
||||||
else if (strcmp (cmd + operand_pos, "..") == 0)
|
else if (DIR_IS_DOTDOT (cmd + operand_pos))
|
||||||
{
|
{
|
||||||
if (vfs_path_elements_count (current_panel->cwd_vpath) != 1 ||
|
if (vfs_path_elements_count (current_panel->cwd_vpath) != 1 ||
|
||||||
strlen (vfs_path_get_by_index (current_panel->cwd_vpath, 0)->path) > 1)
|
strlen (vfs_path_get_by_index (current_panel->cwd_vpath, 0)->path) > 1)
|
||||||
|
@ -172,9 +172,7 @@ handle_dirent (dir_list * list, const char *fltr, struct dirent *dp,
|
|||||||
{
|
{
|
||||||
vfs_path_t *vpath;
|
vfs_path_t *vpath;
|
||||||
|
|
||||||
if (dp->d_name[0] == '.' && dp->d_name[1] == 0)
|
if (DIR_IS_DOT (dp->d_name) || DIR_IS_DOTDOT (dp->d_name))
|
||||||
return 0;
|
|
||||||
if (dp->d_name[0] == '.' && dp->d_name[1] == '.' && dp->d_name[2] == 0)
|
|
||||||
return 0;
|
return 0;
|
||||||
if (!panels_options.show_dot_files && (dp->d_name[0] == '.'))
|
if (!panels_options.show_dot_files && (dp->d_name[0] == '.'))
|
||||||
return 0;
|
return 0;
|
||||||
@ -449,7 +447,7 @@ do_sort (dir_list * list, sortfn * sort, int top, gboolean reverse_f, gboolean c
|
|||||||
|
|
||||||
/* If there is an ".." entry the caller must take care to
|
/* If there is an ".." entry the caller must take care to
|
||||||
ensure that it occupies the first list element. */
|
ensure that it occupies the first list element. */
|
||||||
if (strcmp (list->list[0].fname, "..") == 0)
|
if (DIR_IS_DOTDOT (list->list[0].fname))
|
||||||
dot_dot_found = 1;
|
dot_dot_found = 1;
|
||||||
|
|
||||||
reverse = reverse_f ? -1 : 1;
|
reverse = reverse_f ? -1 : 1;
|
||||||
@ -510,9 +508,7 @@ handle_path (dir_list * list, const char *path,
|
|||||||
{
|
{
|
||||||
vfs_path_t *vpath;
|
vfs_path_t *vpath;
|
||||||
|
|
||||||
if (path[0] == '.' && path[1] == 0)
|
if (DIR_IS_DOT (path) || DIR_IS_DOTDOT (path))
|
||||||
return 0;
|
|
||||||
if (path[0] == '.' && path[1] == '.' && path[2] == 0)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
vpath = vfs_path_from_str (path);
|
vpath = vfs_path_from_str (path);
|
||||||
|
@ -524,9 +524,7 @@ do_compute_dir_size (const vfs_path_t * dirname_vpath, void *ui,
|
|||||||
{
|
{
|
||||||
vfs_path_t *tmp_vpath;
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
if (strcmp (dirent->d_name, ".") == 0)
|
if (DIR_IS_DOT (dirent->d_name) || DIR_IS_DOTDOT (dirent->d_name))
|
||||||
continue;
|
|
||||||
if (strcmp (dirent->d_name, "..") == 0)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tmp_vpath = vfs_path_append_new (dirname_vpath, dirent->d_name, NULL);
|
tmp_vpath = vfs_path_append_new (dirname_vpath, dirent->d_name, NULL);
|
||||||
@ -1076,7 +1074,7 @@ recursive_erase (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s)
|
|||||||
FileProgressStatus return_status = FILE_CONT;
|
FileProgressStatus return_status = FILE_CONT;
|
||||||
vfs_path_t *vpath;
|
vfs_path_t *vpath;
|
||||||
|
|
||||||
if (strcmp (s, "..") == 0)
|
if (DIR_IS_DOTDOT (s))
|
||||||
return FILE_RETRY;
|
return FILE_RETRY;
|
||||||
|
|
||||||
vpath = vfs_path_from_str (s);
|
vpath = vfs_path_from_str (s);
|
||||||
@ -1092,10 +1090,9 @@ recursive_erase (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s)
|
|||||||
{
|
{
|
||||||
vfs_path_t *tmp_vpath;
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
if (!strcmp (next->d_name, "."))
|
if (DIR_IS_DOT (next->d_name) || DIR_IS_DOTDOT (next->d_name))
|
||||||
continue;
|
|
||||||
if (!strcmp (next->d_name, ".."))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
path = mc_build_filename (s, next->d_name, NULL);
|
path = mc_build_filename (s, next->d_name, NULL);
|
||||||
tmp_vpath = vfs_path_from_str (path);
|
tmp_vpath = vfs_path_from_str (path);
|
||||||
if (mc_lstat (tmp_vpath, &buf) != 0)
|
if (mc_lstat (tmp_vpath, &buf) != 0)
|
||||||
@ -1151,17 +1148,15 @@ check_dir_is_empty (const vfs_path_t * vpath)
|
|||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
int i;
|
int i = 1;
|
||||||
|
|
||||||
dir = mc_opendir (vpath);
|
dir = mc_opendir (vpath);
|
||||||
if (!dir)
|
if (dir == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 1, d = mc_readdir (dir); d; d = mc_readdir (dir))
|
for (d = mc_readdir (dir); d != NULL; d = mc_readdir (dir))
|
||||||
|
if (!DIR_IS_DOT (d->d_name) && !DIR_IS_DOTDOT (d->d_name))
|
||||||
{
|
{
|
||||||
if (d->d_name[0] == '.' && (d->d_name[1] == '\0' ||
|
|
||||||
(d->d_name[1] == '.' && d->d_name[2] == '\0')))
|
|
||||||
continue; /* "." or ".." */
|
|
||||||
i = 0;
|
i = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1178,10 +1173,7 @@ erase_dir_iff_empty (FileOpContext * ctx, const char *s)
|
|||||||
FileProgressStatus error;
|
FileProgressStatus error;
|
||||||
vfs_path_t *s_vpath;
|
vfs_path_t *s_vpath;
|
||||||
|
|
||||||
if (strcmp (s, "..") == 0)
|
if (DIR_IS_DOT (s) || DIR_IS_DOTDOT (s))
|
||||||
return FILE_SKIP;
|
|
||||||
|
|
||||||
if (strcmp (s, ".") == 0)
|
|
||||||
return FILE_SKIP;
|
return FILE_SKIP;
|
||||||
|
|
||||||
file_progress_show_deleting (ctx, s);
|
file_progress_show_deleting (ctx, s);
|
||||||
@ -2207,12 +2199,11 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
|
|||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
vfs_path_t *tmp_vpath;
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now, we don't want '.' and '..' to be created / copied at any time
|
* Now, we don't want '.' and '..' to be created / copied at any time
|
||||||
*/
|
*/
|
||||||
if (!strcmp (next->d_name, "."))
|
if (DIR_IS_DOT (next->d_name) || DIR_IS_DOTDOT (next->d_name))
|
||||||
continue;
|
|
||||||
if (!strcmp (next->d_name, ".."))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* get the filename and add it to the src directory */
|
/* get the filename and add it to the src directory */
|
||||||
@ -2441,14 +2432,6 @@ erase_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * s_
|
|||||||
{
|
{
|
||||||
FileProgressStatus error;
|
FileProgressStatus error;
|
||||||
|
|
||||||
/*
|
|
||||||
if (strcmp (s, "..") == 0)
|
|
||||||
return FILE_SKIP;
|
|
||||||
|
|
||||||
if (strcmp (s, ".") == 0)
|
|
||||||
return FILE_SKIP;
|
|
||||||
*/
|
|
||||||
|
|
||||||
file_progress_show_deleting (ctx, vfs_path_as_str (s_vpath));
|
file_progress_show_deleting (ctx, vfs_path_as_str (s_vpath));
|
||||||
if (check_progress_buttons (ctx) == FILE_ABORT)
|
if (check_progress_buttons (ctx) == FILE_ABORT)
|
||||||
return FILE_ABORT;
|
return FILE_ABORT;
|
||||||
@ -2672,7 +2655,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
|||||||
else
|
else
|
||||||
source = panel_get_file (panel);
|
source = panel_get_file (panel);
|
||||||
|
|
||||||
if (strcmp (source, "..") == 0)
|
if (DIR_IS_DOTDOT (source))
|
||||||
{
|
{
|
||||||
g_free (source);
|
g_free (source);
|
||||||
message (D_ERROR, MSG_ERROR, _("Cannot operate on \"..\"!"));
|
message (D_ERROR, MSG_ERROR, _("Cannot operate on \"..\"!"));
|
||||||
|
@ -717,7 +717,7 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
|||||||
char *temp_dir;
|
char *temp_dir;
|
||||||
|
|
||||||
temp_dir = in_start->buffer;
|
temp_dir = in_start->buffer;
|
||||||
if ((temp_dir[0] == '\0') || ((temp_dir[0] == '.') && (temp_dir[1] == '\0')))
|
if (*temp_dir == '\0' || DIR_IS_DOT (temp_dir))
|
||||||
temp_dir = g_strdup (vfs_path_as_str (current_panel->cwd_vpath));
|
temp_dir = g_strdup (vfs_path_as_str (current_panel->cwd_vpath));
|
||||||
else
|
else
|
||||||
temp_dir = g_strdup (temp_dir);
|
temp_dir = g_strdup (temp_dir);
|
||||||
@ -768,7 +768,7 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
|||||||
s = tilde_expand (*start_dir);
|
s = tilde_expand (*start_dir);
|
||||||
canonicalize_pathname (s);
|
canonicalize_pathname (s);
|
||||||
|
|
||||||
if (s[0] == '.' && s[1] == '\0')
|
if (DIR_IS_DOT (s))
|
||||||
{
|
{
|
||||||
*start_dir = g_strdup (vfs_path_as_str (current_panel->cwd_vpath));
|
*start_dir = g_strdup (vfs_path_as_str (current_panel->cwd_vpath));
|
||||||
/* FIXME: is current_panel->cwd_vpath canonicalized? */
|
/* FIXME: is current_panel->cwd_vpath canonicalized? */
|
||||||
@ -792,7 +792,7 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!options.ignore_dirs_enable || in_ignore->buffer[0] == '\0'
|
if (!options.ignore_dirs_enable || in_ignore->buffer[0] == '\0'
|
||||||
|| (in_ignore->buffer[0] == '.' && in_ignore->buffer[1] == '\0'))
|
|| DIR_IS_DOT (in_ignore->buffer))
|
||||||
*ignore_dirs = NULL;
|
*ignore_dirs = NULL;
|
||||||
else
|
else
|
||||||
*ignore_dirs = g_strdup (in_ignore->buffer);
|
*ignore_dirs = g_strdup (in_ignore->buffer);
|
||||||
@ -1306,7 +1306,7 @@ do_search (WDialog * h)
|
|||||||
;
|
;
|
||||||
} /* while (!dp) */
|
} /* while (!dp) */
|
||||||
|
|
||||||
if (strcmp (dp->d_name, ".") == 0 || strcmp (dp->d_name, "..") == 0)
|
if (DIR_IS_DOT (dp->d_name) || DIR_IS_DOTDOT (dp->d_name))
|
||||||
{
|
{
|
||||||
/* skip invalid filenames */
|
/* skip invalid filenames */
|
||||||
while ((dp = mc_readdir (dirp)) != NULL && !str_is_valid_string (dp->d_name))
|
while ((dp = mc_readdir (dirp)) != NULL && !str_is_valid_string (dp->d_name))
|
||||||
|
@ -779,10 +779,10 @@ read_file_system_list (int need_fs_type)
|
|||||||
char *name;
|
char *name;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (strcmp (d->d_name, "..") == 0)
|
if (DIR_IS_DOT (d->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp (d->d_name, ".") == 0)
|
if (DIR_IS_DOTDOT (d->d_name))
|
||||||
name = g_strdup ("/");
|
name = g_strdup ("/");
|
||||||
else
|
else
|
||||||
name = g_strconcat ("/", d->d_name, (char *) NULL);
|
name = g_strconcat ("/", d->d_name, (char *) NULL);
|
||||||
|
@ -501,10 +501,8 @@ string_file_size (file_entry * fe, int len)
|
|||||||
static char buffer[BUF_TINY];
|
static char buffer[BUF_TINY];
|
||||||
|
|
||||||
/* Don't ever show size of ".." since we don't calculate it */
|
/* Don't ever show size of ".." since we don't calculate it */
|
||||||
if (!strcmp (fe->fname, ".."))
|
if (DIR_IS_DOTDOT (fe->fname))
|
||||||
{
|
|
||||||
return _("UP--DIR");
|
return _("UP--DIR");
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||||
if (S_ISBLK (fe->st.st_mode) || S_ISCHR (fe->st.st_mode))
|
if (S_ISBLK (fe->st.st_mode) || S_ISCHR (fe->st.st_mode))
|
||||||
@ -528,7 +526,7 @@ string_file_size_brief (file_entry * fe, int len)
|
|||||||
return _("SYMLINK");
|
return _("SYMLINK");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((S_ISDIR (fe->st.st_mode) || fe->f.link_to_dir) && strcmp (fe->fname, ".."))
|
if ((S_ISDIR (fe->st.st_mode) || fe->f.link_to_dir) && !DIR_IS_DOTDOT (fe->fname))
|
||||||
{
|
{
|
||||||
return _("SUB-DIR");
|
return _("SUB-DIR");
|
||||||
}
|
}
|
||||||
@ -1007,7 +1005,7 @@ display_mini_info (WPanel * panel)
|
|||||||
else
|
else
|
||||||
tty_print_string (str_fit_to_term (_("<readlink failed>"), w->cols - 2, J_LEFT));
|
tty_print_string (str_fit_to_term (_("<readlink failed>"), w->cols - 2, J_LEFT));
|
||||||
}
|
}
|
||||||
else if (strcmp (panel->dir.list[panel->selected].fname, "..") == 0)
|
else if (DIR_IS_DOTDOT (panel->dir.list[panel->selected].fname))
|
||||||
{
|
{
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
* while loading directory (do_load_dir() and do_reload_dir()),
|
* while loading directory (do_load_dir() and do_reload_dir()),
|
||||||
@ -4377,7 +4375,7 @@ do_file_mark (WPanel * panel, int idx, int mark)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Only '..' can't be marked, '.' isn't visible */
|
/* Only '..' can't be marked, '.' isn't visible */
|
||||||
if (strcmp (panel->dir.list[idx].fname, "..") == 0)
|
if (DIR_IS_DOTDOT (panel->dir.list[idx].fname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
file_mark (panel, idx, mark);
|
file_mark (panel, idx, mark);
|
||||||
|
@ -429,10 +429,7 @@ do_panelize_cd (struct WPanel *panel)
|
|||||||
|
|
||||||
for (i = 0; i < panelized_panel.count; i++)
|
for (i = 0; i < panelized_panel.count; i++)
|
||||||
{
|
{
|
||||||
if (panelized_same
|
if (panelized_same || DIR_IS_DOTDOT (panelized_panel.list.list[i].fname))
|
||||||
|| (panelized_panel.list.list[i].fname[0] == '.'
|
|
||||||
&& panelized_panel.list.list[i].fname[1] == '.'
|
|
||||||
&& panelized_panel.list.list[i].fname[2] == '\0'))
|
|
||||||
{
|
{
|
||||||
list->list[i].fnamelen = panelized_panel.list.list[i].fnamelen;
|
list->list[i].fnamelen = panelized_panel.list.list[i].fnamelen;
|
||||||
list->list[i].fname = g_strndup (panelized_panel.list.list[i].fname,
|
list->list[i].fname = g_strndup (panelized_panel.list.list[i].fname,
|
||||||
|
@ -748,7 +748,7 @@ tree_store_mark_checked (const char *subname)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Calculate the full name of the subdirectory */
|
/* Calculate the full name of the subdirectory */
|
||||||
if (subname[0] == '.' && (subname[1] == 0 || (subname[1] == '.' && subname[2] == 0)))
|
if (DIR_IS_DOT (subname) || DIR_IS_DOTDOT (subname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cname = vfs_path_as_str (ts.check_name);
|
cname = vfs_path_as_str (ts.check_name);
|
||||||
@ -927,18 +927,12 @@ tree_store_rescan (const vfs_path_t * vpath)
|
|||||||
{
|
{
|
||||||
vfs_path_t *tmp_vpath;
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
if (dp->d_name[0] == '.')
|
if (DIR_IS_DOT (dp->d_name) || DIR_IS_DOTDOT (dp->d_name))
|
||||||
{
|
|
||||||
if (dp->d_name[1] == 0 || (dp->d_name[1] == '.' && dp->d_name[2] == 0))
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
tmp_vpath = vfs_path_append_new (vpath, dp->d_name, NULL);
|
tmp_vpath = vfs_path_append_new (vpath, dp->d_name, NULL);
|
||||||
if (mc_lstat (tmp_vpath, &buf) != -1)
|
if (mc_lstat (tmp_vpath, &buf) != -1 && S_ISDIR (buf.st_mode))
|
||||||
{
|
|
||||||
if (S_ISDIR (buf.st_mode))
|
|
||||||
tree_store_mark_checked (dp->d_name);
|
tree_store_mark_checked (dp->d_name);
|
||||||
}
|
|
||||||
vfs_path_free (tmp_vpath);
|
vfs_path_free (tmp_vpath);
|
||||||
}
|
}
|
||||||
mc_closedir (dirp);
|
mc_closedir (dirp);
|
||||||
|
@ -1221,7 +1221,7 @@ do_subshell_chdir (const vfs_path_t * vpath, gboolean update_prompt)
|
|||||||
bPathNotEq = strcmp (p_subshell_cwd, p_current_panel_cwd);
|
bPathNotEq = strcmp (p_subshell_cwd, p_current_panel_cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPathNotEq && strcmp (pcwd, ".") != 0)
|
if (bPathNotEq && !DIR_IS_DOT (pcwd))
|
||||||
{
|
{
|
||||||
char *cwd;
|
char *cwd;
|
||||||
|
|
||||||
|
@ -265,9 +265,9 @@ extfs_find_entry_int (struct entry *dir, const char *name, GSList * list,
|
|||||||
c = *q;
|
c = *q;
|
||||||
*q = '\0';
|
*q = '\0';
|
||||||
|
|
||||||
if (strcmp (p, ".") != 0)
|
if (!DIR_IS_DOT (p))
|
||||||
{
|
{
|
||||||
if (strcmp (p, "..") == 0)
|
if (DIR_IS_DOTDOT (p))
|
||||||
pent = pent->dir;
|
pent = pent->dir;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -540,7 +540,7 @@ extfs_read_archive (int fstype, const char *name, struct archive **pparc)
|
|||||||
*(p++) = '\0';
|
*(p++) = '\0';
|
||||||
q = cfn;
|
q = cfn;
|
||||||
}
|
}
|
||||||
if (S_ISDIR (hstat.st_mode) && (strcmp (p, ".") == 0 || strcmp (p, "..") == 0))
|
if (S_ISDIR (hstat.st_mode) && (DIR_IS_DOT (p) || DIR_IS_DOTDOT (p)))
|
||||||
goto read_extfs_continue;
|
goto read_extfs_continue;
|
||||||
pent = extfs_find_entry (current_archive->root_entry, q, TRUE, FALSE);
|
pent = extfs_find_entry (current_archive->root_entry, q, TRUE, FALSE);
|
||||||
if (pent == NULL)
|
if (pent == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user