Re: drag&drop filename
Re: drag&drop filename
- Subject: Re: drag&drop filename
- From: glenn andreas <email@hidden>
- Date: Sun, 2 Dec 2007 08:55:58 -0600
On Dec 2, 2007, at 5:42 AM, Paul Grant wrote:
I am trying to get the filename of provided file (as argv[1] -
psn_0_... ) to my cocoa app, upon start.
You do realize that when you drop a file on an application's icon in
the finder, it is not pass as one of the command line arguments,
right? So if you have an issue with supporting drag & drop, check out
NSApplication's delegate open methods.
This is the code that I am using but without luck, after two days
googling for a solution:
ProcessSerialNumber psn =
{ StripPsnStrAndGetHighLong( argv[ 1 ] ), 0 };
ProcessInfoRec info;
FSSpec fs;
info.processAppSpec = &fs;
GetProcessInformation( &psn, &info );
I expected to have the filename here info.processAppSpec->name but
there is garbish :-(
At best, this will get you a pascal style string (which can't
accurately represent all file names in a manner that is useful).
FSSpec's are very depricated and shouldn't be used for new code...
If you want the process name, check out NSProcessInfo.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next
generation of fractal art
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden