Package gaiasky.util
Class SysUtils
java.lang.Object
gaiasky.util.SysUtils
Some handy system utilities and constants.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static boolean
static boolean
checkI3()
static boolean
checkKDE()
static boolean
checkLinuxDesktop
(String desktop) static boolean
static boolean
static String
static Path
Returns the default cache directory, for non-essential data.static Path
static Path
Gets a file pointer to the crash reports directory, where crash reports are stored.static Path
Gets a pointer to the shader output directory for the crash reports.static Path
Returns the default data directory.static Path
Gets a file pointer to the bookmarks directory.static Path
Gets a file pointer to the camera directory.static Path
Gets a file pointer to the frames directory.static Path
Gets a file pointer to the mappings directory.static Path
Gets a file pointer to the mpcdi directory.static Path
Gets a file pointer to the music directory.static Path
Gets a file pointer to the default screenshots directory.static int[]
Gets the current display resolution.static Path
static double
static Path
static Path
Gets a file pointer to the local data directory where the data files are downloaded and stored.static Path
Gets a file pointer to the log directory, where the log for the last session is stored.static String
static String
static String
static String
static String
static Path
static Path
static Path
Gets the path to the file containing the release notes.static Path
Gets the path to the file containing the last shown release notes version.static Path
Returns the default shader cache directory.static Path
getTempDir
(String dataLocation) Gets the path to the actual temporary directory in the data folder.static Path
static String
static boolean
Returns whether we are running in an AppImage.static boolean
isAppImagePath
(String path) Checks if the given file path belongs to an AppImage.static boolean
static boolean
static boolean
isLinux()
static boolean
isMac()
static boolean
static boolean
static boolean
isUnix()
static boolean
static boolean
static boolean
isX11()
static boolean
static void
static void
mkdirs()
Initialize directories.static com.badlogic.gdx.graphics.Pixmap
pixmapFromGLTexture
(com.badlogic.gdx.graphics.Texture t) 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.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.static Path
uniqueFileName
(Path file)
-
Constructor Details
-
SysUtils
public SysUtils()
-
-
Method Details
-
mkdirs
public static void mkdirs()Initialize directories. -
mkdir
-
getXdgDesktop
-
checkLinuxDesktop
-
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
-
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
-
getOSVersion
-
getDefaultCameraDir
Gets a file pointer to the camera directory.- Returns:
- A pointer to the Gaia Sky camera directory.
-
getDefaultScreenshotsDir
Gets a file pointer to the default screenshots directory.- Returns:
- A pointer to the Gaia Sky screenshots directory.
-
getDefaultFramesDir
Gets a file pointer to the frames directory.- Returns:
- A pointer to the Gaia Sky frames directory.
-
getDefaultMusicDir
Gets a file pointer to the music directory.- Returns:
- A pointer to the Gaia Sky music directory.
-
getDefaultMappingsDir
Gets a file pointer to the mappings directory.- Returns:
- A pointer to the Gaia Sky mappings directory.
-
getMappingsDirName
-
getDefaultBookmarksDir
Gets a file pointer to the bookmarks directory.- Returns:
- A pointer to the Gaia Sky bookmarks directory.
-
getBookmarksDirName
-
getDefaultMpcdiDir
Gets a file pointer to the mpcdi directory.- Returns:
- A pointer to the Gaia Sky mpcdi directory.
-
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
Gets a file pointer to the crash reports directory, where crash reports are stored.- Returns:
- A pointer to the crash reports directory.
-
getCrashShadersDir
Gets a pointer to the shader output directory for the crash reports.- Returns:
- A pointer to the shader output directory.
-
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
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
Returns the default data directory. That is ~/.gaiasky/ in Windows and macOS, and ~/.local/share/gaiasky in Linux.- Returns:
- Default data directory.
-
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
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
-
getHomeDir
-
getUserHome
-
getLocalAppDataTemp
-
getJavaVersion
public static double getJavaVersion() -
getReleaseNotesFile
Gets the path to the file containing the release notes.- Returns:
- Path to the release notes file
-
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
-
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
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
-
uniqueFileName
-