Monday, November 08, 2010 at 12:02 AM.

system.verbs.builtins.Frontier.getFileSuffix

on getFileSuffix (type, flForceNonEmptySuffix=false) {
	<<Changes
		<<11/20/07; 8:12:57 AM by DW
			<<Optional parameter, flForceNonEmptySuffix, allows callers on Mac to get a non-empty extension.
		<<Old notes
			<<Given an object type, return the proper suffix for that type of file
				<<On Mac it returns the empty string.
				<<PBS 1/10/98: Returns "fatp" for scalars.
	local (s = "");
	local (flnonempty = false, os = sys.os ());
	if (os == "Win95") or (os == "WinNT") or flForceNonEmptySuffix {
		flnonempty = true};
	if flnonempty {
		case type {
			wptextType {
				s = "ftwp"};
			menubarType {
				s = "ftmb"};
			outlineType {
				s = "ftop"};
			scriptType {
				s = "ftsc"};
			tableType {
				s = "fttb"}}
		else {
			return ("fatp")}};
	<<case sys.os ()
		<<"Win95"
		<<"WinNT"
			<<case type
				<<wptextType
					<<s = "ftwp"
				<<menubarType
					<<s = "ftmb"
				<<outlineType
					<<s = "ftop"
				<<scriptType
					<<s = "ftsc"
				<<tableType
					<<s = "fttb"
			<<else
				<<return ("fatp")
	return (s)}
<<bundle //test code
	<<dialog.alert (getFileSuffix (outlineType, true))



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.