Professional Web Applications Themes

Cocoa File Copy with proper progress indication - Mac Programming

I'm wondering if anyone has found away (maybe I missed a way) to get a progress callback (selector) for a file copy in cocoa. I'm going to be copying some large files, and there is a progress indicator indicating the copy progress (duh), but I would like it to update during a specific file copy, not just update after a copy has executed. How can I get a message letting my app update the progress? Any Ideas? T...

  1. #1

    Default Cocoa File Copy with proper progress indication

    I'm wondering if anyone has found away (maybe I missed a way) to get a
    progress callback (selector) for a file copy in cocoa.
    I'm going to be copying some large files, and there is a progress indicator
    indicating the copy progress (duh), but I would like it to update during a
    specific file copy, not just update after a copy has executed.
    How can I get a message letting my app update the progress?

    Any Ideas?
    T

    Tim Guest

  2. #2

    Default Re: Cocoa File Copy with proper progress indication

    dans l'article BCA5A818.700F%org, Tim R Johnson à
    org a écrit le 17/04/04 0:12:
     

    Do a manual copy using low level routines and provide you own progress
    indicator...

    Eric

    Eric Guest

  3. #3

    Default Re: Cocoa File Copy with proper progress indication

    In article <BCA5A818.700F%org>,
    Tim R Johnson <org> wrote:
     

    Should everything else stop as the copy runs? If not, execute the copy
    operation in its own thread and have it message the main thread with
    updates. The exact nature depends on how you define "progress". That
    is, doing it for every MB copied would be very different than doing it
    every second.
    Doc Guest

  4. #4

    Default Re: Cocoa File Copy with proper progress indication

    > Do a manual copy using low level routines and provide you own progress 

    I would suggest he *not* do that. Correctly copying a file on MacOS is a
    nontrivial task. Except for in a few special cases, you'll have to copy
    the data fork, the resource fork, and you have to make sure the file
    attributes match. This is annoying but straightforward if you are
    copying between local volumes, but if a network volume is involved, you
    have to also take care to correctly handle drop boxes etc.

    You may want to look at Apple's MoreFilesX sample code, it contains a
    file copy routine that you could probably copy, rename and modify. The
    code is Carbon though, like much lower-level stuff in MacOS X. As
    opposed to other cases, this is an advantage: Carbon's File Manager
    routines are significantly faster than the ones Apple built into Cocoa.
    E.g. FSCatalogSearch and FSCatalogInfoBulk beat NSDirectoryEnumerator
    hands-down.

    Still Cocoa is more comfy to use. You may want to wrap the code in a
    nice little ObjC class. At least that's what I do when I have to
    eliminate some bottleneck.

    Cheers,
    -- M. Uli Kusterer.
    Uli Guest

Similar Threads

  1. File Upload Progress Bar
    By BeDigital in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 0
    Last Post: May 20th, 03:34 PM
  2. LMS Quiz--selecting the proper portion of a pdf file? Possible with tracking?
    By hudgevudge@yahoo.com in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: March 14th, 07:57 PM
  3. Replies: 2
    Last Post: October 6th, 06:51 PM
  4. Proper include file extension?
    By Bruce W...1 in forum PHP Development
    Replies: 2
    Last Post: September 22nd, 05:22 PM
  5. newbie cocoa file reading/writing files
    By Richard Humiston in forum Mac Programming
    Replies: 1
    Last Post: July 21st, 02:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139