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

Comparing BasiliskII/src/Unix/extfs_unix.cpp (file contents):
Revision 1.8 by cebix, 1999-11-08T17:00:13Z vs.
Revision 1.9 by cebix, 1999-11-08T18:06:00Z

# Line 384 | Line 384 | bool extfs_remove(const char *path)
384          make_helper_path(path, helper_path, ".rsrc/", false);
385          remove(helper_path);
386  
387 <        // Now remove file or directory
387 >        // Now remove file or directory (and helper directories in the directory)
388          if (remove(path) < 0) {
389 <                if (errno == EISDIR)
389 >                if (errno == EISDIR || errno == ENOTEMPTY) {
390 >                        helper_path[0] = 0;
391 >                        strncpy(helper_path, path, MAX_PATH_LENGTH-1);
392 >                        add_path_component(helper_path, ".finf");
393 >                        rmdir(helper_path);
394 >                        helper_path[0] = 0;
395 >                        strncpy(helper_path, path, MAX_PATH_LENGTH-1);
396 >                        add_path_component(helper_path, ".rsrc");
397 >                        rmdir(helper_path);
398                          return rmdir(path) == 0;
399 <                else
399 >                } else
400                          return false;
401          }
402          return true;
403   }
404 +
405 +
406 + /*
407 + *  Rename/move file/directory (and associated helper files),
408 + *  returns false on error (and sets errno)
409 + */
410 +
411 + bool extfs_rename(const char *old_path, const char *new_path)
412 + {
413 +        // Rename helpers first, don't complain if this fails
414 +        char old_helper_path[MAX_PATH_LENGTH], new_helper_path[MAX_PATH_LENGTH];
415 +        make_helper_path(old_path, old_helper_path, ".finf/", false);
416 +        make_helper_path(new_path, new_helper_path, ".finf/", false);
417 +        create_helper_dir(new_path, ".finf/");
418 +        rename(old_helper_path, new_helper_path);
419 +        make_helper_path(old_path, old_helper_path, ".rsrc/", false);
420 +        make_helper_path(new_path, new_helper_path, ".rsrc/", false);
421 +        create_helper_dir(new_path, ".rsrc/");
422 +        rename(old_helper_path, new_helper_path);
423 +
424 +        // Now rename file
425 +        return rename(old_path, new_path) == 0;
426 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines