--- BasiliskII/src/Unix/extfs_unix.cpp 1999/11/01 16:24:15 1.6 +++ BasiliskII/src/Unix/extfs_unix.cpp 1999/11/08 17:00:13 1.8 @@ -123,7 +123,7 @@ static int open_helper(const char *path, char helper_path[MAX_PATH_LENGTH]; make_helper_path(path, helper_path, add); - if ((flag & O_RDWR) || (flag && O_WRONLY)) + if ((flag & O_ACCMODE) == O_RDWR || (flag & O_ACCMODE) == O_WRONLY) flag |= O_CREAT; int fd = open(helper_path, flag, 0666); if (fd < 0) { @@ -368,3 +368,28 @@ size_t extfs_write(int fd, void *buffer, errno = 0; return write(fd, buffer, length); } + + +/* + * Remove file/directory (and associated helper files), + * returns false on error (and sets errno) + */ + +bool extfs_remove(const char *path) +{ + // Remove helpers first, don't complain if this fails + char helper_path[MAX_PATH_LENGTH]; + make_helper_path(path, helper_path, ".finf/", false); + remove(helper_path); + make_helper_path(path, helper_path, ".rsrc/", false); + remove(helper_path); + + // Now remove file or directory + if (remove(path) < 0) { + if (errno == EISDIR) + return rmdir(path) == 0; + else + return false; + } + return true; +}