Mercurial > cgi-bin > hgweb.cgi > ImagePrep
comparison src/name/blackcap/imageprep/Files.kt @ 30:098c4f5507c7
Convert to JDK 15.
author | David Barts <n5jrn@me.com> |
---|---|
date | Mon, 13 Jun 2022 11:31:49 -0700 |
parents | 5234e4500d45 |
children |
comparison
equal
deleted
inserted
replaced
29:e90d290a9a8d | 30:098c4f5507c7 |
---|---|
17 /* OS Type */ | 17 /* OS Type */ |
18 | 18 |
19 enum class OS { | 19 enum class OS { |
20 MAC, UNIX, WINDOWS, OTHER; | 20 MAC, UNIX, WINDOWS, OTHER; |
21 companion object { | 21 companion object { |
22 private val rawType = System.getProperty("os.name")?.toLowerCase() | 22 private val rawType = System.getProperty("os.name")?.lowercase() |
23 val type = if (rawType == null) { | 23 val type = if (rawType == null) { |
24 OTHER | 24 OTHER |
25 } else if (rawType.contains("win")) { | 25 } else if (rawType.contains("win")) { |
26 WINDOWS | 26 WINDOWS |
27 } else if (rawType.contains("mac")) { | 27 } else if (rawType.contains("mac")) { |
38 | 38 |
39 fun joinPath(base: String, vararg rest: String) = rest.fold(File(base), ::File) | 39 fun joinPath(base: String, vararg rest: String) = rest.fold(File(base), ::File) |
40 | 40 |
41 /* file names */ | 41 /* file names */ |
42 | 42 |
43 private val SHORTNAME = Application.MYNAME.toLowerCase() | 43 private val SHORTNAME = Application.MYNAME.lowercase() |
44 private val LONGNAME = "name.blackcap." + SHORTNAME | 44 private val LONGNAME = "name.blackcap." + SHORTNAME |
45 private val HOME = System.getenv("HOME") | 45 private val HOME = System.getenv("HOME") |
46 val PF_DIR = when (OS.type) { | 46 val PF_DIR = when (OS.type) { |
47 OS.MAC -> joinPath(HOME, "Library", "Application Support", LONGNAME) | 47 OS.MAC -> joinPath(HOME, "Library", "Application Support", LONGNAME) |
48 OS.WINDOWS -> joinPath(System.getenv("APPDATA"), LONGNAME) | 48 OS.WINDOWS -> joinPath(System.getenv("APPDATA"), LONGNAME) |