Platform:
Filter:
Classes | Platform

Platform : Object

handle cross-platform differencies
Source: Platform.sc
Subclasses: UnixPlatform

Description

The Platform class (along with its subclasses) handles things which differ between operating systems (mac/linux/windows/...), to simplify cross-platform aspects of SuperCollider.

Platform is an abstract class encapsulating various platform dependent constants and properties, such as directories, primitive features and startup files. The platform object is accessible through the platform method of the main process instance:

Currently implemented platforms include: OSXPlatform, LinuxPlatform, WindowsPlatform, UnixPlatform.

Class Methods

Most of Platforms class methods are simply wrappers to thisProcess.platform.method.

Platform name and platform dependent actions

Platform.case( ... cases)

Perform actions depending on the current platform (name), just like Object:switch:

Platform.ideName

returns a String indicating which IDE the language believes it is running in. (Often this is determined via the "-i" option to the sclang executable.) This is determined when sclang starts and cannot be changed dynamically.

The main purpose of this is to include/exclude folders from the class search patch depending on which IDE is in use: for example, if the value of ideName is "scapp" then folders named "scide_scapp" are included and all other folders beginning with "scide_" are excluded. The default value of this is "none".

Known IDE names in use are "scapp" (SuperCollider.app on Mac), "scvim" (vim), "scel" (emacs). Others may be used.

Directories and filesystem stuff

Platform.classLibraryDir

location of the bundled class library

Platform.helpDir

location of the bundled help files

Platform.systemAppSupportDir

system application support directory

Platform.systemExtensionDir

system extension directory (see Using Extensions)

Platform.userHomeDir

user home directory

Platform.userAppSupportDir

user application support directory

Platform.userConfigDir

directory for configuration files

Platform.userExtensionDir

user extension directory (see Using Extensions)

Platform.platformDir

platform specific directory for class files (see Using Extensions)

Platform.pathSeparator

platform specific path separator

Platform.resourceDir

platform specific resource directory

Platform.recordingsDir

platform recordings directory

Platform.defaultTempDir

default directory for temporary files

Platform.hasQt

true if the Qt library is available, false otherwise

Platform.hasQtWebEngine

true if the QtWebEngine library is available, false otherwise

Platform.architecture

A Symbol naming the architecture for which this version of SuperCollider was built. Returns one of 'AArch32' (32-bit ARM), 'AArch64' (64-bit ARM, introduced in ARMv8), 'Itanium64', 'i386', 'x86_64', 'PowerPC', or 'unknown' if the architecture is unidentifiable.

Features

Platform.when(features, ifFunction, elseFunction)

Evaluate ifFunction if all features are present, otherwise evaluate elseFunction.

Inherited class methods

Undocumented class methods

Platform.clearMetadata(path)

Platform.deprecatedStartupFiles(paths)

Platform.hasBelaSupport

Platform.isPathSeparator(char)

Platform.makeServerWindowAction

Platform.makeServerWindowAction = value

Platform.makeSynthDescWindowAction

Platform.makeSynthDescWindowAction = value

Platform.openHTMLFileAction

Platform.openHTMLFileAction = value

Platform.openHelpFileAction

Platform.openHelpFileAction = value

Platform.pathDelimiter

Instance Methods

.name

returns the platform name

.recompile

recompile class library

Directories and filesystem stuff

.classLibraryDir

location of the bundled class library

.helpDir

location of the bundled help files

.systemAppSupportDir

system application support directory

.systemExtensionDir

system extension directory (see Using Extensions)

.userHomeDir

user home directory

.userAppSupportDir

user application support directory

.userConfigDir

directory for configuration files

.userExtensionDir

user extension directory (see Using Extensions)

.platformDir

platform specific directory for class files (see Using Extensions)

.pathSeparator

platform specific path separator

.pathDelimiter

platform specific path delimiter

.recordingsDir

.recordingsDir = value

platform recordings directory

.resourceDir

platform specific resource directory

.defaultTempDir

default directory for temporary files

.formatPathForCmdLine(path)

Arguments:

path

A path string.

Returns:

The input string formatted as a command-line argument. On Windows this method quotes the string. On Unix-based systems this method escapes space characters with a backslash.

Startup files

.startupFiles

files to be loaded on startup

.loadStartupFiles

(re)load startup files

System commands

.killAll(cmdLineArgs)

kill all processes as defined by cmdLineArgs.

Arguments:

cmdLineArgs

a string containing one or several process names.

.killProcessByID(pid)

kill a single process as identified by its process ID.

Arguments:

pid

an Integer which is the pid of the process to kill.

Features

Features are abstract symbols that can be declared by extension authors and be checked during runtime in user code. Apart from explicitly declared features, class and primitive names are implicitly declared.

.declareFeature(aFeature)

Declare aSymbol to be a feature present in the runtime. Class names and primitive names cannot be declared as features.

.hasFeature(symbol)

Return true if the feature aSymbol is present in the runtime system. aSymbol can refer to explicitly declared features as well as class and primitive names.

.when(features, ifFunction, elseFunction)

Evaluate ifFunction if all features are present, otherwise evaluate elseFunction.

Inherited instance methods

Undocumented instance methods

.clearMetadata(path)

.defaultGUIScheme

.devLoc(inpath)

.devpath

.devpath = value

.ideName

.initPlatform

.isPathSeparator(char)

.isSleeping

.writeClientCSS