2 * filenot.c: wrapper for routines to notify the
3 * tree about the changes made to the directory
15 #include "../vfs/vfs.h"
17 static char *get_absolute_name (char *file
)
19 char dir
[MC_MAXPATHLEN
];
21 if (file
[0] == PATH_SEP
)
22 return g_strdup (file
);
23 mc_get_current_wd (dir
, MC_MAXPATHLEN
);
24 return concat_dir_and_file (dir
, file
);
28 my_mkdir_rec (char *s
, mode_t mode
)
33 if (!mc_mkdir (s
, mode
))
35 else if (errno
!= ENOENT
)
38 /* FIXME: should check instead if s is at the root of that filesystem */
39 if (!vfs_file_is_local (s
))
42 if (!strcmp (s
, PATH_SEP_STR
)) {
47 p
= concat_dir_and_file (s
, "..");
51 if (!(result
= my_mkdir_rec (q
, mode
)))
52 result
= mc_mkdir (s
, mode
);
59 my_mkdir (char *s
, mode_t mode
)
63 result
= mc_mkdir (s
, mode
);
65 /* .ado: it will be disabled in OS/2 and NT */
66 /* otherwise crash if directory already exists. */
70 char *p
= vfs_canon (s
);
72 result
= my_mkdir_rec (p
, mode
);
76 s
= get_absolute_name (s
);
79 tree_add_entry (tree
, s
);
87 int my_rmdir (char *s
)
94 /* FIXME: Should receive a Wtree! */
95 result
= mc_rmdir (s
);
97 s
= get_absolute_name (s
);
100 tree_remove_entry (tree
, s
);