3 var <classLibraryDir, <helpDir, <>recordingsDir, features;
8 classLibraryDir = thisMethod.filenameSymbol.asString.dirname.dirname;
9 helpDir = thisMethod.filenameSymbol.asString.dirname.dirname.dirname ++ "/Help";
10 features = IdentityDictionary.new;
11 recordingsDir = this.userAppSupportDir +/+ "Recordings";
14 name { ^this.subclassResponsibility }
16 recompile { ^this.subclassResponsibility }
18 ^thisProcess.platform.name.switch(*cases)
22 *classLibraryDir { ^thisProcess.platform.classLibraryDir }
23 *helpDir { ^thisProcess.platform.helpDir }
25 systemAppSupportDir { _Platform_systemAppSupportDir }
26 *systemAppSupportDir { ^thisProcess.platform.systemAppSupportDir }
28 userAppSupportDir { _Platform_userAppSupportDir }
29 *userAppSupportDir { ^thisProcess.platform.userAppSupportDir }
31 systemExtensionDir { _Platform_systemExtensionDir }
32 *systemExtensionDir { ^thisProcess.platform.systemExtensionDir }
34 userExtensionDir { _Platform_userExtensionDir }
35 *userExtensionDir { ^thisProcess.platform.userExtensionDir }
37 // The "ideName" is for ide-dependent compilation.
38 // From SC.app, the value is "scapp" meaning "scide_scapp" folders will be compiled and other "scide_*" ignored.
39 ideName { _Platform_ideName }
40 *ideName { ^thisProcess.platform.ideName }
42 platformDir { ^this.name.asString }
43 *platformDir { ^thisProcess.platform.platformDir }
45 pathSeparator { ^this.subclassResponsibility }
46 *pathSeparator { ^thisProcess.platform.pathSeparator }
48 isPathSeparator { |char| ^this.subclassResponsibility }
49 *isPathSeparator { |char| ^thisProcess.platform.isPathSeparator(char) }
51 clearMetadata { |path| ^this.subclassResponsibility }
52 *clearMetadata { |path| ^thisProcess.platform.clearMetadata(path) }
54 getMouseCoords { ^this.subclassResponsibility }
55 *getMouseCoords { ^thisProcess.platform.getMouseCoords }
57 // startup/shutdown hooks
62 loadStartupFiles { this.startupFiles.do{|afile|
63 afile = afile.standardizePath;
64 if(File.exists(afile), {afile.load})
69 declareFeature { | aFeature |
70 var str = aFeature.asString;
71 if (str.first.isUpper) {
72 Error("cannot declare class name features").throw;
74 if (str.first == $_) {
75 Error("cannot declare primitive name features").throw;
77 features.put(aFeature, true);
79 hasFeature { | symbol |
80 if (features.includesKey(symbol).not) {
83 symbol.asSymbol.asClass.notNil or: { symbol.isPrimitive }
88 when { | features, ifFunction, elseFunction |
89 ^features.asArray.inject(true, { |v,x|
90 v and: { this.hasFeature(x) }
91 }).if(ifFunction, elseFunction)
93 *when { | features, ifFunction, elseFunction |
94 ^thisProcess.platform.when(features, ifFunction, elseFunction)
97 // Prefer qt but fall back to swing if qt not installed.
98 defaultGUIScheme { if (GUI.get(\qt).notNil) {^\qt} {^\swing} }
99 defaultHIDScheme { ^\none }
101 isSleeping { ^false } // unless defined otherwise
103 // used on systems to deduce a svn directory path, if system wide location is used for installed version. (tested on Linux).
106 if ( devpath.isNil ){ ^inpath };
107 outpath = inpath.copyToEnd( inpath.find( "SuperCollider") );
108 outpath = outpath.replace( "SuperCollider", devpath );
112 // hook for clients to write frontend.css
117 UnixPlatform : Platform
119 pathSeparator { ^$/ }
121 isPathSeparator { |char|
122 ^(char === this.pathSeparator)
125 clearMetadata { |path|
126 "rm -f %\.*meta".format(path.splitext[0].escapeChar($ )).systemCmd;
131 pipe = Pipe("arch", "r");