Mercurial > cgi-bin > hgweb.cgi > ImagePrep
comparison src/name/blackcap/imageprep/Misc.kt @ 5:884f1415a330
Rationalized directory management.
author | David Barts <n5jrn@me.com> |
---|---|
date | Fri, 17 Jul 2020 17:11:43 -0700 |
parents | 0bded24f746e |
children | 2bb46da74667 |
comparison
equal
deleted
inserted
replaced
4:5234e4500d45 | 5:884f1415a330 |
---|---|
244 "Unable to ${op} ${fileName}:\n ${msg}" | 244 "Unable to ${op} ${fileName}:\n ${msg}" |
245 } | 245 } |
246 JOptionPane.showMessageDialog(parent, | 246 JOptionPane.showMessageDialog(parent, |
247 dmsg, "Error", JOptionPane.ERROR_MESSAGE) | 247 dmsg, "Error", JOptionPane.ERROR_MESSAGE) |
248 } | 248 } |
249 | |
250 private val homeDir = System.getProperty("user.home") | |
251 fun tilde(s: String?): String { | |
252 if (s.isNullOrEmpty()) | |
253 return homeDir | |
254 if (s.startsWith("~/") || s.startsWith("~\\")) | |
255 return File(homeDir, s.substring(2).trimStart(s[1])).toString() | |
256 else | |
257 return s | |
258 } |