Package gaiasky.util

Class SysUtils

java.lang.Object
gaiasky.util.SysUtils

public class SysUtils extends Object
Some handy system utilities and constants.
  • Constructor Details

    • SysUtils

      public SysUtils()
  • Method Details

    • mkdirs

      public static void mkdirs()
      Initialize directories.
    • mkdir

      public static void mkdir(Path dir)
    • getXdgDesktop

      public static String getXdgDesktop()
    • checkLinuxDesktop

      public static boolean checkLinuxDesktop(String desktop)
    • checkUnity

      public static boolean checkUnity()
    • checkGnome

      public static boolean checkGnome()
    • checkKDE

      public static boolean checkKDE()
    • checkXfce

      public static boolean checkXfce()
    • checkBudgie

      public static boolean checkBudgie()
    • checkI3

      public static boolean checkI3()
    • getOSName

      public static String getOSName()
    • getOSFamily

      public static String getOSFamily()
    • isLinux

      public static boolean isLinux()
    • isX11

      public static boolean isX11()
    • isWayland

      public static boolean isWayland()
    • isWindows

      public static boolean isWindows()
    • isMac

      public static boolean isMac()
    • isFlatpak

      public static boolean isFlatpak()
    • isAppleSiliconMac

      public static boolean isAppleSiliconMac()
    • isUnix

      public static boolean isUnix()
    • isSolaris

      public static boolean isSolaris()
    • isSteamDeck

      public static boolean isSteamDeck()
    • launchedViaInstall4j

      public static boolean launchedViaInstall4j()
    • getOSArchitecture

      public static String getOSArchitecture()
    • getOSVersion

      public static String getOSVersion()
    • getDefaultCameraDir

      public static Path getDefaultCameraDir()
      Gets a file pointer to the camera directory.
      Returns:
      A pointer to the Gaia Sky camera directory.
    • getDefaultScreenshotsDir

      public static Path getDefaultScreenshotsDir()
      Gets a file pointer to the default screenshots directory.
      Returns:
      A pointer to the Gaia Sky screenshots directory.
    • getDefaultFramesDir

      public static Path getDefaultFramesDir()
      Gets a file pointer to the frames directory.
      Returns:
      A pointer to the Gaia Sky frames directory.
    • getDefaultMusicDir

      public static Path getDefaultMusicDir()
      Gets a file pointer to the music directory.
      Returns:
      A pointer to the Gaia Sky music directory.
    • getDefaultMappingsDir

      public static Path getDefaultMappingsDir()
      Gets a file pointer to the mappings directory.
      Returns:
      A pointer to the Gaia Sky mappings directory.
    • getMappingsDirName

      public static String getMappingsDirName()
    • getDefaultBookmarksDir

      public static Path getDefaultBookmarksDir()
      Gets a file pointer to the bookmarks directory.
      Returns:
      A pointer to the Gaia Sky bookmarks directory.
    • getBookmarksDirName

      public static String getBookmarksDirName()
    • getDefaultMpcdiDir

      public static Path getDefaultMpcdiDir()
      Gets a file pointer to the mpcdi directory.
      Returns:
      A pointer to the Gaia Sky mpcdi directory.
    • getLocalDataDir

      public static Path getLocalDataDir()
      Gets a file pointer to the local data directory where the data files are downloaded and stored.
      Returns:
      A pointer to the local data directory where the data files are.
    • getCrashReportsDir

      public static Path getCrashReportsDir()
      Gets a file pointer to the crash reports directory, where crash reports are stored.
      Returns:
      A pointer to the crash reports directory.
    • getCrashShadersDir

      public static Path getCrashShadersDir()
      Gets a pointer to the shader output directory for the crash reports.
      Returns:
      A pointer to the shader output directory.
    • getLogDir

      public static Path getLogDir()
      Gets a file pointer to the log directory, where the log for the last session is stored.
      Returns:
      A pointer to the log directory.
    • getTempDir

      public static Path getTempDir(String dataLocation)
      Gets the path to the actual temporary directory in the data folder. It needs the location of the user-configured data folder as input.
      Parameters:
      dataLocation - The user-defined data location.
      Returns:
      A path that points to the temporary directory.
    • getDataDir

      public static Path getDataDir()
      Returns the default data directory. That is ~/.gaiasky/ in Windows and macOS, and ~/.local/share/gaiasky in Linux.
      Returns:
      Default data directory.
    • getCacheDir

      public static Path getCacheDir()
      Returns the default cache directory, for non-essential data. This is ~/.gaiasky/ in Windows and macOS, and ~/.cache/gaiasky in Linux.
      Returns:
      The default cache directory.
    • getShaderCacheDir

      public static Path getShaderCacheDir()
      Returns the default shader cache directory. This is ~/.gaiasky/shadercache/ in Windows and macOS, and ~/.cache/gaiasky/shadercache/ in Linux.
      Returns:
      The default shader cache directory.
    • getConfigDir

      public static Path getConfigDir()
    • getHomeDir

      public static Path getHomeDir()
    • getUserHome

      public static Path getUserHome()
    • getLocalAppDataTemp

      public static Path getLocalAppDataTemp()
    • getJavaVersion

      public static double getJavaVersion()
    • getReleaseNotesFile

      public static Path getReleaseNotesFile()
      Gets the path to the file containing the release notes.
      Returns:
      Path to the release notes file
    • getReleaseNotesRevisionFile

      public static Path getReleaseNotesRevisionFile()
      Gets the path to the file containing the last shown release notes version. This file is typically in the configuration directory.
      Returns:
      Path to the release notes revision file
    • getProceduralPixmapDir

      public static Path getProceduralPixmapDir()
    • saveProceduralGLTexture

      public static void saveProceduralGLTexture(com.badlogic.gdx.graphics.Texture texture, String name, Settings.ImageFormat format)
      Saves the given texture with the given name to disk as an image file with the given format.
      Parameters:
      texture - The texture to save.
      name - The name of the texture.
      format - The image format to use.
    • saveProceduralGLTextures

      public static void saveProceduralGLTextures(com.badlogic.gdx.graphics.Texture[] textures, String[] names, Settings.ImageFormat format)
      Saves all the given textures with the given names to disk as image files with the given format. This works in two steps. First, the pixmaps are prepared from the textures in the current thread. Then, the pixmaps are saved to disk in a separate thread using the executor service.
      Parameters:
      textures - The textures to save.
      names - The names of the textures.
      format - The image format to use.
    • pixmapFromGLTexture

      public static com.badlogic.gdx.graphics.Pixmap pixmapFromGLTexture(com.badlogic.gdx.graphics.Texture t)
    • isAppImagePath

      public static boolean isAppImagePath(String path)
      Checks if the given file path belongs to an AppImage.
      Parameters:
      path - The path to check.
      Returns:
      Whether the path to the file belongs to an AppImage or not.
    • isAppImage

      public static boolean isAppImage()
      Returns whether we are running in an AppImage.
      Returns:
      True if we are in an AppImage package.
    • getDisplayResolution

      public static int[] getDisplayResolution()
      Gets the current display resolution.
      Returns:
      The display resolution in an array with [width, height], or null if the resolution could not be determined.
    • getProgramDirectory

      public static Path getProgramDirectory()
    • uniqueFileName

      public static Path uniqueFileName(Path file)