aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
diff options
context:
space:
mode:
authoreuxane2024-09-18 23:41:13 +0200
committereuxane2024-09-18 23:41:13 +0200
commit9c18fbdcb677deed0ff956782eeb637d0bef3275 (patch)
tree0f8bc70635dc299cccedacb5ac809544ace5a466 /app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
parent09a608d6a3b0af70dd28a889b2977783b1cf9982 (diff)
downloadtincapp-9c18fbdcb677deed0ff956782eeb637d0bef3275.tar.gz
paths: rename log -> logs directory
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.kt8
1 files changed, 4 insertions, 4 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 1d0879a..c1bb27e 100644
--- a/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
+++ b/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
@@ -27,7 +27,7 @@ import java.io.FileNotFoundException
27 * @implNote Logs and PID files are stored in the cache directory for automatic collection. 27 * @implNote Logs and PID files are stored in the cache directory for automatic collection.
28 */ 28 */
29object AppPaths { 29object AppPaths {
30 private const val APP_LOG_DIR = "log" 30 private const val APP_LOGS_DIR = "logs"
31 private const val APP_TINC_RUNTIME_DIR = "run" 31 private const val APP_TINC_RUNTIME_DIR = "run"
32 private const val APP_TINC_NETWORKS_DIR = "networks" 32 private const val APP_TINC_NETWORKS_DIR = "networks"
33 33
@@ -54,7 +54,7 @@ object AppPaths {
54 private fun binDir() = File(context.applicationInfo.nativeLibraryDir) 54 private fun binDir() = File(context.applicationInfo.nativeLibraryDir)
55 55
56 fun runtimeDir() = withDir(File(privateCacheDir(), APP_TINC_RUNTIME_DIR)) 56 fun runtimeDir() = withDir(File(privateCacheDir(), APP_TINC_RUNTIME_DIR))
57 fun logDir() = withDir(File(privateCacheDir(), APP_LOG_DIR)) 57 fun logsDir() = withDir(File(privateCacheDir(), APP_LOGS_DIR))
58 fun confDir() = withDir(File(privateFilesDir(), APP_TINC_NETWORKS_DIR)) 58 fun confDir() = withDir(File(privateFilesDir(), APP_TINC_NETWORKS_DIR))
59 59
60 fun confDir(netName: String) = File(confDir(), netName) 60 fun confDir(netName: String) = File(confDir(), netName)
@@ -62,9 +62,9 @@ object AppPaths {
62 fun netConfFile(netName: String) = File(confDir(netName), NET_CONF_FILE) 62 fun netConfFile(netName: String) = File(confDir(netName), NET_CONF_FILE)
63 fun tincConfFile(netName: String) = File(confDir(netName), NET_TINC_CONF_FILE) 63 fun tincConfFile(netName: String) = File(confDir(netName), NET_TINC_CONF_FILE)
64 fun invitationFile(netName: String) = File(confDir(netName), NET_INVITATION_FILE) 64 fun invitationFile(netName: String) = File(confDir(netName), NET_INVITATION_FILE)
65 fun logFile(netName: String) = File(logDir(), String.format(LOGFILE_FORMAT, netName)) 65 fun logFile(netName: String) = File(logsDir(), String.format(LOGFILE_FORMAT, netName))
66 fun pidFile(netName: String) = File(runtimeDir(), String.format(PIDFILE_FORMAT, netName)) 66 fun pidFile(netName: String) = File(runtimeDir(), String.format(PIDFILE_FORMAT, netName))
67 fun appLogFile() = File(logDir(), APPLOG_FILE) 67 fun appLogFile() = File(logsDir(), APPLOG_FILE)
68 fun crashFlagFile() = File(privateCacheDir(), CRASHFLAG_FILE) 68 fun crashFlagFile() = File(privateCacheDir(), CRASHFLAG_FILE)
69 69
70 fun existing(f: File) = f.apply { if (!exists()) throw FileNotFoundException(f.absolutePath) } 70 fun existing(f: File) = f.apply { if (!exists()) throw FileNotFoundException(f.absolutePath) }