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.3 by cebix, 1999-11-08T17:00:11Z vs.
Revision 1.4 by cebix, 1999-11-08T18:05:57Z

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines