Add verification pass to updateDefaultPaths method
Some checks failed
PRs & Pushes / build (push) Failing after 1m39s
PRs & Pushes / build-apidoc (push) Failing after 1m49s

This commit is contained in:
JeremyStar™ 2024-12-15 13:50:53 +01:00
parent 1fc337d9b8
commit 2cfc8cad9d
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -139,34 +139,43 @@ class FileAccess {
* Updates all default paths to
* their platform-specific path.
*
* @throws VerificationFailedException if path creation fails
* @since v1-alpha10
*/
@Throws(VerificationFailedException::class)
internal fun updateDefaultPaths() {
logger.diag("Updating default paths")
// Storage
homeDirectory = FileAccess(System.getProperty("user.home")).createDirectory()
homeDirectory = FileAccess(System.getProperty("user.home"))
.createDirectory().verifyIsDirectory()
configDirectory = FileAccess(when (Environment.operatingSystem) {
LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.config"
WINDOWS -> "${homeDirectory}/AppData/Roaming/sosengine-config"
else -> "${homeDirectory}/.sosengine/config"
}).createDirectory()
}).createDirectory().verifyIsDirectory()
dataDirectory = FileAccess(when (Environment.operatingSystem) {
LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.local/share"
WINDOWS -> "${homeDirectory}/AppData/Roaming/sosengine-data"
else -> "${homeDirectory}/.sosengine/data"
}).createDirectory()
}).createDirectory().verifyIsDirectory()
// Caches
temporaryCacheDirectory = FileAccess(
System.getProperty("java.io.tmpdir")
+ "/sosengine-cache-"
+ ProcessHandle.current().pid()
).createDirectory().deleteOnShutdown()
).createDirectory().verifyIsDirectory().deleteOnShutdown()
persistentCacheDirectory = FileAccess(when (Environment.operatingSystem) {
LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.cache"
WINDOWS -> "${homeDirectory}/AppData/Local/Temp"
else -> "${homeDirectory}/.sosengine/persistent-cache"
}).createDirectory()
}).createDirectory().verifyIsDirectory()
}