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

Re: [Sc-devel] File-extension



hey,

wonderful idea, wasn't aware of String:quote (it's not documented in String helpfile) Changed to this implementation. Any objections on adding this to core sclang? How to handle windows problem (are there documented guidelines on cross-platform class extensions?)

best regards
Till


+ File {
	*isRegularFile { arg pathName;
		^("test -f %".format(pathName.quote).systemCmd == 0)
	}
	*isDirectory  { arg pathName;
		^("test -d %".format(pathName.quote).systemCmd == 0)
	}
	*isRTFD {arg pathName;
		^((pathName.splitext.last == "rtfd") && {this.isDirectory(pathName)})
	}
}

possible help text for String:quote
---------------------------------

quote
surrounds this String by ".
"Hello".quote.postln


On 26.11.2007, at 13:06, Dan Stowell wrote:

Hi Till -

.quote is probably slightly better than .escapeChar($ ) since the
string might have other weird things in like tabs or asterisks? (Yuck!
But it can happen.) Just a thought.

I'd be happy for these to be in core. Shame they won't work on
Windows, but I suppose they can be overridden.

Dan


2007/11/26, Till Bovermann <tboverma@xxxxxxxxxxxxxxxxxxxxxxxx>:
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?

regards
Till
_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel



--
http://www.mcld.co.uk
_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel