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

Re: [MacPerl] Mac path name length?



In article <mac-perl.v03110700b1cbe647fd4d@[10.0.2.15]>, Greg Dunn
<gregdunn@indy.net> wrote:

>Anyway, I'm just wondering if the Mac has a pathname limit under MacPerl; I
>seem to remember the path name (as opposed to the basename) can be pretty
>long.  Isn't it something like 255 chars?  I don't want to inadvertently
>hand it a humongous path that causes weird behavior in Perl (it's been
>robust so far).

I'm not sure if there is currently a limit, but if there is, it will
probably go away, for the following reason: I expect that the underlying
toolbox call is FSMakeFSSpec, which in theory takes a volume ref number,
folder ID, and file name as arguments, but you can pass it a full or
partial path instead of a simple file name. This parameter is a
Pascal-style string, so is limited to 255 characters. But, if a program
"walks" the partial path itself, rather than just handing it to
FSMakeFSSpec, there shouldn't be a length limit. I'm not sure which is
currently done by MacPerl, but under Carbon you will have to pass
filenames and not partial paths to FSMakeFSSpec, so that's why I say the
limitation will probably go away if it is currently present.

>Am I better off to chdir into each dir and process the
>basenames only?  Is that contrary to common UN*X procedure?

You could do this; there is a CPAN module mentioned in the Camel book
which iterates directories, and it mentioned that it chdir's as it goes.
It seems that it could make your script a little more messy, but you might
not care.
-- 
__________________________________________________________________________

Jeff Clites                Online Editor           http://www.MacTech.com/
online@MacTech.com         MacTech Magazine
__________________________________________________________________________

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch