[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-Toolbox] How do I parse FSSpec?




I have a path of a file and i would like to create another file next 
to it on the same folder.

For example: I have the path "MyHD:Mac Perl:some.pl" and I would like 
to create file with the path  "MyHD:Mac Perl:some.pl.copy".

What i would do in C is:

FSSpec old_file_spec, new_file_spec;
iErr = FSMakeFSSpec(0, 0, "\pMyHD:Mac Perl:some.pl", &old_file_spec); 
// if full path first two params are ignored
iErr = FSMakeFSSpec(old_file_spec.vRefNum, old_file_spec.parID, 
"\psome.pl.copy", &new_file_spec);
iErr = FSpCreate(&new_file_spec, 'wxyz', 'wxyz', 0);

When trying this in Perl I realized I did not know how to extract the 
vRefNum and parID from the FFSpec:

my($old_file_spec, $new_file_spec);
$old_file_spec = MacPerl::MakeFSSpec("MyHD:Mac Perl:some.pl");
$new_file_spec = FSMakeFSSpec(???, ???, "some.pl.copy");


How do I fill in the ???

And BTW is there a better "perlish" way of doing the whole thing?

Thanks for any info or pointers...
Shai Spharim
Director of Software Development

ksWaves Ltd.
23, Kalisher St.
Tel-Aviv
Israel 65165

Email: shai@kswaves.com
Home page: http://www.waves.com
Phone +972-35107667 ext. 123
Fax +972-35105881
___________________________________________
Computers are useless. They can only give you answers.
- Pablo Picasso.

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org