Class SysUtils
java.lang.Object
gaiasky.util.SysUtils
Some handy system utilities and constants.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanstatic booleancheckI3()static booleancheckKDE()static booleancheckLinuxDesktop(String desktop) static booleanstatic booleanstatic Stringstatic PathReturns the default cache directory, for non-essential data.static Pathstatic PathGets a file pointer to the crash reports directory, where crash reports are stored.static PathGets a pointer to the shader output directory for the crash reports.static PathgetDataCacheDir(String dataLocation) Gets the path to the actual cache directory in the data folder.static PathReturns the default data directory.static PathgetDataTempDir(String dataLocation) Gets the path to the actual temporary directory in the data folder.static PathGets a file pointer to the bookmarks directory.static PathGets a file pointer to the camera directory.static PathGets a file pointer to the default directory where datasets are downloaded and stored.static PathGets a file pointer to the frames' directory.static PathGets a file pointer to the mappings' directory.static PathGets a file pointer to the MPCDI directory.static PathGets a file pointer to the default screenshots directory.static int[]Gets the current display resolution.static Pathstatic doublestatic Pathstatic PathGets a file pointer to the log directory, where the log for the last session is stored.static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Pathstatic Pathstatic PathGets the path to the file containing the release notes.static PathGets the path to the file containing the last shown release notes version.static PathReturns the default shader cache directory.static Pathstatic Stringstatic booleanReturns whether we are running in an AppImage.static booleanisAppImagePath(String path) Checks if the given file path belongs to an AppImage.static booleanstatic booleanstatic booleanstatic booleanstatic booleanisLinux()static booleanisMac()static booleanstatic booleanstatic booleanisUnix()static booleanstatic booleanstatic booleanisX11()static booleanstatic voidstatic voidmkdirs()Initialize directories.static com.badlogic.gdx.graphics.PixmappixmapFromGLTexture(com.badlogic.gdx.graphics.Texture t) static voidsaveProceduralGLTexture(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 voidsaveProceduralGLTextures(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 PathuniqueFileName(Path file)
-
Field Details
-
TMP_DIR_NAME
- See Also:
-
CACHE_DIR_NAME
- See Also:
-
-
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() -
isGLFWX11
public static boolean isGLFWX11() -
isWayland
public static boolean isWayland() -
isGLFWWayland
public static boolean isGLFWWayland() -
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.
-
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.
-
getDefaultDatasetsDir
Gets a file pointer to the default directory where datasets are downloaded and stored.- Returns:
- A pointer to the default datasets directory.
-
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.
-
getDataTempDir
Gets the path to the actual temporary directory in the data folder. It needs the location of the user-configured data folder as input.The temp directory is used to store partial dataset downloads and data descriptors.
- Parameters:
dataLocation- The user-defined data location.- Returns:
- A path that points to the temporary directory.
-
getDataCacheDir
Gets the path to the actual cache directory in the data folder. It needs the location of the user-configured data folder as input.The cache directory is used to store TLE and other time-changing data.
- Parameters:
dataLocation- The user-defined data location.- Returns:
- A path that points to the cache directory.
-
getDataDir
Returns the default data directory. That is~/.gaiasky/in Windows and macOS, and~/.local/share/gaiaskyin Linux.- Returns:
- Default data directory.
-
getCacheDir
Returns the default cache directory, for non-essential data. This is~/.gaiasky/in Windows and macOS, and~/.cache/gaiaskyin 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
-