processing.app

## Class Platform

- Object
- - Platform

-     public class Platform
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Platform()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `deleteFile(File file)` Attempts to move to the Trash on OS X, or the Recycle Bin on Windows.
    `static File` | `getContentFile(String name)` Get reference to a file adjacent to the executable on Windows and Linux, or inside Contents/Resources/Java on Mac OS X.
    `static File` | `getDefaultSketchbookFolder()`
    `static String` | `getenv(String variable)`
    `static int` | `getIndex(String what)`
    `static File` | `getJavaHome()`
    `static String` | `getJavaPath()` Get the path to the embedded Java executable.
    `static String` | `getName()`
    `static String` | `getName(int which)` Map a platform constant to its name.
    `static String` | `getNativeArch()` Return the value of the os.arch property
    `static int` | `getNativeBits()` Return whether sketches will run as 32- or 64-bits based on the JVM that's in use.
    `static File` | `getSettingsFolder()`
    `static String` | `getVariant()`
    `static String` | `getVariant(int platform, String arch, int bits)`
    `static void` | `init()`
    `static void` | `initBase(Base base)`
    `static boolean` | `isLinux()` true if running on linux.
    `static boolean` | `isMacOS()` returns true if Processing is running on a Mac OS X machine.
    `static boolean` | `isWindows()` returns true if running on windows.
    `static void` | `openFolder(File file)` Implements the other cross-platform headache of opening a folder in the machine's native file browser.
    `static boolean` | `openFolderAvailable()` Used to determine whether to disable the "Show Sketch Folder" option.
    `static void` | `openURL(String url)` Implements the cross-platform headache of opening URLs.
    `static void` | `saveLanguage(String languageCode)`
    `static void` | `setenv(String variable, String value)`
    `static void` | `setLookAndFeel()`
    `static int` | `unsetenv(String variable)`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Platform

          public Platform()

  - ### Method Detail

    - #### init

          public static void init()

    - #### initBase

          public static void initBase(Base base)
                               throws Exception

      Throws:
        `Exception`

    - #### setLookAndFeel

          public static void setLookAndFeel()
                                     throws Exception

      Throws:
        `Exception`

    - #### getSettingsFolder

          public static File getSettingsFolder()
                                        throws Exception

      Throws:
        `Exception`

    - #### getDefaultSketchbookFolder

          public static File getDefaultSketchbookFolder()
                                                 throws Exception

      Throws:
        `Exception`

    - #### saveLanguage

          public static void saveLanguage(String languageCode)

    - #### openURL

          public static void openURL(String url)

      Implements the cross-platform headache of opening URLs. For 2.0a8 and later, this requires the parameter to be an actual URL, meaning that you can't send it a file:// path without a prefix. It also just calls into Platform, which now uses java.awt.Desktop (where possible, meaning not on Linux) now that we're requiring Java 6. As it happens the URL must also be properly URL-encoded.

    - #### openFolderAvailable

          public static boolean openFolderAvailable()

      Used to determine whether to disable the "Show Sketch Folder" option.
      Returns:
        true If a means of opening a folder is known to be available.

    - #### openFolder

          public static void openFolder(File file)

      Implements the other cross-platform headache of opening a folder in the machine's native file browser.

    - #### getNativeBits

          public static int getNativeBits()

      Return whether sketches will run as 32- or 64-bits based on the JVM that's in use.

    - #### getNativeArch

          public static String getNativeArch()

      Return the value of the os.arch property

    - #### getVariant

          public static String getVariant()

    - #### getVariant

          public static String getVariant(int platform,
                                          String arch,
                                          int bits)

    - #### getName

          public static String getName()

    - #### getName

          public static String getName(int which)

      Map a platform constant to its name.
      Parameters:
        `which` - PConstants.WINDOWS, PConstants.MACOSX, PConstants.LINUX
      Returns:
        one of "windows", "macosx", or "linux"

    - #### getIndex

          public static int getIndex(String what)

    - #### isMacOS

          public static boolean isMacOS()

      returns true if Processing is running on a Mac OS X machine.

    - #### isWindows

          public static boolean isWindows()

      returns true if running on windows.

    - #### isLinux

          public static boolean isLinux()

      true if running on linux.

    - #### getContentFile

          public static File getContentFile(String name)

      Get reference to a file adjacent to the executable on Windows and Linux, or inside Contents/Resources/Java on Mac OS X. This will return the local JRE location, *whether or not it is the active JRE*.

    - #### getJavaHome

          public static File getJavaHome()

    - #### getJavaPath

          public static String getJavaPath()

      Get the path to the embedded Java executable.

    - #### deleteFile

          public static boolean deleteFile(File file)
                                    throws IOException

      Attempts to move to the Trash on OS X, or the Recycle Bin on Windows. Also tries to find a suitable Trash location on Linux. If not possible, just deletes the file or folder instead.
      Parameters:
        `file` - the folder or file to be removed/deleted
      Returns:
        true if the folder was successfully removed
      Throws:
        `IOException`

    - #### setenv

          public static void setenv(String variable,
                                    String value)

    - #### getenv

          public static String getenv(String variable)

    - #### unsetenv

          public static int unsetenv(String variable)