OSUtils
These APIs provide utility methods to retrieve information about the current operating system where the application is running on
getApplicationRoamingDataDirectoryPath
Description
Method used to get the application roaming data directory path
The directory retrieved is:
- Windows:
%APPDATA% - macOS:
~/Library/Application Support - Linux:
$XDG_DATA_HOMEor~/.local/shareas default
Usage
getApplicationRoamingDataDirectory
Description
Method used to get the application roaming data directory
The directory retrieved is:
- Windows:
%APPDATA% - macOS:
~/Library/Application Support - Linux:
$XDG_DATA_HOMEor~/.local/shareas default
Usage
getApplicationLocalDataDirectoryPath
Description
Method used to get the application local data directory path
The directory retrieved is:
- Windows:
%LOCALAPPDATA% - macOS:
~/Library/Application Support - Linux:
~/.local/share
Usage
getApplicationLocalDataDirectory
Description
Method used to get the application local data directory
The directory retrieved is:
- Windows:
%LOCALAPPDATA% - macOS:
~/Library/Application Support - Linux:
~/.local/share
Usage
val directory: File = getApplicationLocalDataDirectory()
println(directory.name) // e.g %LOCALAPPDATA%
getConfigurationDirectoryPath
Description
Method used to get the configuration directory path
The directory retrieved is:
- Windows:
%APPDATA% - macOS:
~/Library/Preferences - Linux:
$XDG_CONFIG_HOMEor~/.configas default
Usage
getConfigurationDirectory
Description
Method used to get the configuration directory
The directory retrieved is:
- Windows:
%APPDATA% - macOS:
~/Library/Preferences - Linux:
$XDG_CONFIG_HOMEor~/.configas default
Usage
getCacheDirectoryPath
Description
- Method used to get the
cachedirectory path
The directory retrieved is:
- Windows:
%LOCALAPPDATA%\Cache - macOS:
~/Library/Caches - Linux:
$XDG_CACHE_HOMEor~/.cacheas default
Usage
getCacheDirectory
Description
- Method used to get the
cachedirectory
The directory retrieved is:
- Windows:
%LOCALAPPDATA%\Cache - macOS:
~/Library/Caches - Linux:
$XDG_CACHE_HOMEor~/.cacheas default
Usage
getTempDirectoryPath
Description
- Method used to get the
tempdirectory path
The directory retrieved is:
- Windows:
%USERPROFILE%\AppData\Local\Temp - macOS:
~/tmp - Linux:
~/tmp
Usage
getTempDirectory
Description
- Method used to get the
tempdirectory
The directory retrieved is:
- Windows:
%USERPROFILE%\AppData\Local\Temp - macOS:
~/tmp - Linux:
~/tmp
Usage
val directory: File = getTempDirectory()
println(directory.name) // e.g %USERPROFILE%\AppData\Local\Temp%
whenIsRunningOn
Utility method used to execute a specific callback for the operating system which the application is currently running on, for example:
whenIsRunningOn(
windows = {
println("Hi from Windows!")
},
macOs = {
println("Hi from macOS!")
},
linux = {
println("Hi from linux!")
}
)
isRunningOn
OperatingSystem
| OS | Description |
|---|---|
| WINDOWS | All the operating systems which are part of the Windows's family |
| MACOS | All the operating systems which are part of the macOS's family |
| LINUX | All the distros which are part of the Linux's family |
Usage
Retrieves the operating system which the application is currently running on, for example: