• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: copyPath and performFileOperation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copyPath and performFileOperation


  • Subject: Re: copyPath and performFileOperation
  • From: Michael Tsai <email@hidden>
  • Date: Mon, 27 Jan 2003 19:19:17 -0500

On Monday, January 27, 2003, at 06:01 PM, Lorenzo Puleo wrote:

Hi Michael,
thank you. May you write/paste some code explaining how to use ditto via
NSTask? I have never heard this.

For NSTask information, see

<http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSTask.html>

There's a man page for ditto, and you probably want to use some variation of:

ditto -rsrcFork src_file dst_file

The code would be something like:

NSString *path = @"/usr/bin/ditto";
NSArray *args = [NSArray arrayWithObjects:@"-rsrcFork", @"src_file", @"dst_file", nil];
NSTask *task = [NSTask launchedTaskWithLaunchPath:path arguments:args];
[task waitUntilExit];
// then check [task terminationStatus]...

As ar as its limitation about copying
Finder information, I use to apply Finder info via FSSetCatalogInfo, so it's
not a problem.

Not all the Finder information is stored in the catalog info. Of course, perhaps copying the catalog info is sufficient for your needs.

Do you know some other limitation/bug/inconvenient (e.g. it doesn't work on
HFS standard, or on no-Mac File Systems, it's slow...) which could refrein
me of implementing this method?

ditto on 10.1 doesn't copy the catalog info, so you'd have to do that separately.

For example, I know that copyPath API uses to fill the RAM with the *whole*
source file, so if you want to copy a 3GBytes file, you need minimum 3GB
free GBytes on your boot disk (which will be used as virtual memory). So, in
cases like this it's very very slow.

Yeah, I filed a bug on that. ditto's buffer is much smaller, in the hundreds of K. The performance is fine.

Also, if you copy a filePackage, later
you still need to copy all the dates, finderInfo, permissions,... to each
file inside the destination filePackage.

I'm pretty sure ditto doesn't have that problem.

--Michael
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • ditto is really better than copyPath
      • From: Lorenzo Puleo <email@hidden>
References: 
 >Re: copyPath and performFileOperation (From: Lorenzo Puleo <email@hidden>)

  • Prev by Date: Re: NSDrawer delegate function mis-described?
  • Next by Date: Re: NSDrawer delegate function mis-described?
  • Previous by thread: Re: copyPath and performFileOperation
  • Next by thread: ditto is really better than copyPath
  • Index(es):
    • Date
    • Thread