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

Re: [Sc-devel] File-extension



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?

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.

And why only testing for RTFD? and not have functions for other extensions?
Why not make a general hasExtension method?

sincerely,
Marije