aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/context/AppPaths.kt')
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/AppPaths.kt11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt b/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
index 1efb7cf..2394586 100644
--- a/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
+++ b/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
@@ -1,6 +1,6 @@
1/* 1/*
2 * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon 2 * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
3 * Copyright (C) 2017-2018 Pacien TRAN-GIRARD 3 * Copyright (C) 2017-2020 Pacien TRAN-GIRARD
4 * 4 *
5 * This program is free software: you can redistribute it and/or modify 5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ import java.io.FileNotFoundException
25/** 25/**
26 * @author pacien 26 * @author pacien
27 * 27 *
28 * @implNote Logs and PID files are stored in the cache directory for easy clean up. 28 * @implNote Logs and PID files are stored in the cache directory for automatic collection.
29 */ 29 */
30object AppPaths { 30object AppPaths {
31 private const val TINCD_BIN = "libtincd.so" 31 private const val TINCD_BIN = "libtincd.so"
@@ -40,15 +40,16 @@ object AppPaths {
40 private const val NET_TINC_CONF_FILE = "tinc.conf" 40 private const val NET_TINC_CONF_FILE = "tinc.conf"
41 private const val NET_HOSTS_DIR = "hosts" 41 private const val NET_HOSTS_DIR = "hosts"
42 private const val NET_INVITATION_FILE = "invitation-data" 42 private const val NET_INVITATION_FILE = "invitation-data"
43 private const val NET_DEFAULT_ED25519_PRIVATE_KEY_FILE = "ed25519_key.priv" 43
44 private const val NET_DEFAULT_RSA_PRIVATE_KEY_FILE = "rsa_key.priv" 44 const val NET_DEFAULT_ED25519_PRIVATE_KEY_FILE = "ed25519_key.priv"
45 const val NET_DEFAULT_RSA_PRIVATE_KEY_FILE = "rsa_key.priv"
45 46
46 private val context by lazy { App.getContext() } 47 private val context by lazy { App.getContext() }
47 48
48 fun storageAvailable() = 49 fun storageAvailable() =
49 Environment.getExternalStorageState().let { it == Environment.MEDIA_MOUNTED && it != Environment.MEDIA_MOUNTED_READ_ONLY } 50 Environment.getExternalStorageState().let { it == Environment.MEDIA_MOUNTED && it != Environment.MEDIA_MOUNTED_READ_ONLY }
50 51
51 private fun internalCacheDir() = context.cacheDir!! 52 fun internalCacheDir() = context.cacheDir!!
52 fun cacheDir() = context.externalCacheDir!! 53 fun cacheDir() = context.externalCacheDir!!
53 fun confDir() = context.getExternalFilesDir(null)!! 54 fun confDir() = context.getExternalFilesDir(null)!!
54 private fun binDir() = File(context.applicationInfo.nativeLibraryDir) 55 private fun binDir() = File(context.applicationInfo.nativeLibraryDir)