cocoa - Is there any detailed doc or sample codes about PBFSCopyFileSync from CoreService framework? -


i trying replace deprecated api pbhcopyfilesync pbfscopyfilesync recommend in files.h header.

surprisingly, apple says several lines new api:

pbfscopyfilesync duplicates file , optionally renames it.  osstatus pbfscopyfilesync (    fsrefparamptr paramblock ); availability available in mac os x v10.5 , later. declared in files.h 

and couldn't find more how use function.

specially, should filled parameter fsrefparamptr? tried code below, keeps getting error of -50.

paramerr     -50     invalid value passed in parameter. application passed invalid parameter dialog options. 

here code:

osstatus res = noerr;  fsrefparam param;  fsref srcfile, dstdir, newfile;  const char *src = "$path_to_a_existing_file"; const char *dst = "/tmp";  res = fspathmakeref((const uint8 *)src, &srcfile, null); assert(res == noerr);  res = fspathmakeref((const uint8 *)dst, &dstdir, null); assert(res == noerr);  memset(&param, 0, sizeof(fsrefparam)); param.iocompletion = null; param.ref = &srcfile; param.parentref = &dstdir; param.newref = &newfile;  res = pbfscopyfilesync(&param);  if (res == noerr) {     printf("success!!!\n"); } else {     printf("failed!!! %d\n", res); } 

so, know detailed documentation or sample codes api? or there more popular/documented c++ api copying files?

thanks.

quinn “the eskimo!” says:

always use fscopyobjectsync. pbfscopyfilesync/pbhcopyfilesync low-level routines exported legacy reasons. fscopyobjectsync proper api takes care of of nittygritty details of copying.

notably, both pbfscopyfilesync , pbhcopyfilesync parameter block routines, no nice wrappers. should consider hint (-:


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -