[Sc-devel] File-extension
Till Bovermann
tboverma at techfak.uni-bielefeld.de
Fri Nov 30 12:17:32 PST 2007
On 27.11.2007, at 22:22, nescivi wrote:
> On Monday 26 November 2007 11:16:37 Till Bovermann wrote:
>> Hey List,
>>
>> unsure where to put these (probably useful) extensions to file:
>>
>> + File {
>> *isRegularFile { arg pathName;
>> ^("test -f %".format(pathName.escapeChar($ )).systemCmd == 0)
>> }
>> *isDirectory { arg pathName;
>> ^("test -d %".format(pathName.escapeChar($ )).systemCmd == 0)
>> }
>> *isRTFD {arg pathName;
>> ^((pathName.splitext.last == "rtfd") && {this.isDirectory
>> (pathName)})
>> }
>> }
>>
>>
>> Any Idea? std-distro / common quark, etc?
>
> there are similar functions in PathName.
> Any reason not to include them there?
ok for me.
>
> Also, I'd rename them to contain something like "exist", since they
> test
> whether the directories or files exist and are what they seem they
> are.
PathName:existsAsRegularFile
PathName:existsAsDirectory
PathName:existsAsRTFD
???
>
> And why only testing for RTFD? and not have functions for other
> extensions?
> Why not make a general hasExtension method?
sure this would make sense... I just did not need it for now. RTFD is
some sort of a strange file format... since it actually is not a file
but a well-structured directory...
<- Till
More information about the Sc-devel
mailing list