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

Re: [Sc-devel] File-extension



Hi Till,

How about "isDirectory" instead of "existsAsDirectory"?
That conforms with isNil, isNumber, etc and is less typing.

RJK
'On Nov 30, 2007, at 6:17 AM, Till Bovermann wrote:


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
_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel