ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/AmigaOS/extfs_amiga.cpp
(Generate patch)

Comparing BasiliskII/src/AmigaOS/extfs_amiga.cpp (file contents):
Revision 1.1 by cebix, 1999-11-01T16:24:09Z vs.
Revision 1.3 by cebix, 1999-11-08T17:00:11Z

# Line 118 | Line 118 | static int open_helper(const char *path,
118          char helper_path[MAX_PATH_LENGTH];
119          make_helper_path(path, helper_path, add);
120  
121 <        if ((flag & O_RDWR) || (flag && O_WRONLY))
121 >        if ((flag & O_ACCMODE) == O_RDWR || (flag & O_ACCMODE) == O_WRONLY)
122                  flag |= O_CREAT;
123          int fd = open(helper_path, flag, 0666);
124          if (fd < 0) {
# Line 365 | Line 365 | size_t extfs_write(int fd, void *buffer,
365   }
366  
367  
368 + /*
369 + *  Remove file/directory (and associated helper files),
370 + *  returns false on error (and sets errno)
371 + */
372 +
373 + bool extfs_remove(const char *path)
374 + {
375 +        // Remove helpers first, don't complain if this fails
376 +        char helper_path[MAX_PATH_LENGTH];
377 +        make_helper_path(path, helper_path, ".finf/", false);
378 +        remove(helper_path);
379 +        make_helper_path(path, helper_path, ".rsrc/", false);
380 +        remove(helper_path);
381 +
382 +        // Now remove file or directory
383 +        if (remove(path) < 0) {
384 +                if (errno == EISDIR)
385 +                        return rmdir(path) == 0;
386 +                else
387 +                        return false;
388 +        }
389 +        return true;
390 + }
391 +
392 +
393   /*
394   *  ftruncate() is missing from libnix
395   */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines