2 filenot.c: wrapper for routines to notify the
3 tree about the changes made to the directory
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include "../vfs/vfs.h"
32 get_absolute_name (char *file
)
34 char dir
[MC_MAXPATHLEN
];
36 if (file
[0] == PATH_SEP
)
37 return g_strdup (file
);
38 mc_get_current_wd (dir
, MC_MAXPATHLEN
);
39 return concat_dir_and_file (dir
, file
);
43 my_mkdir_rec (char *s
, mode_t mode
)
48 if (!mc_mkdir (s
, mode
))
50 else if (errno
!= ENOENT
)
53 /* FIXME: should check instead if s is at the root of that filesystem */
54 if (!vfs_file_is_local (s
))
57 if (!strcmp (s
, PATH_SEP_STR
)) {
62 p
= concat_dir_and_file (s
, "..");
66 if (!(result
= my_mkdir_rec (q
, mode
)))
67 result
= mc_mkdir (s
, mode
);
74 my_mkdir (char *s
, mode_t mode
)
78 result
= mc_mkdir (s
, mode
);
80 /* .ado: it will be disabled in Win32 */
81 /* otherwise crash if directory already exists. */
85 char *p
= vfs_canon (s
);
87 result
= my_mkdir_rec (p
, mode
);
91 s
= get_absolute_name (s
);
94 tree_add_entry (tree
, s
);
110 /* FIXME: Should receive a Wtree! */
111 result
= mc_rmdir (s
);
113 s
= get_absolute_name (s
);
116 tree_remove_entry (tree
, s
);