Add verification pass to updateDefaultPaths method
This commit is contained in:
parent
1fc337d9b8
commit
2cfc8cad9d
1 changed files with 14 additions and 5 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue