This commit is contained in:
Syer10
2021-07-09 22:04:02 -04:00
parent c9279a92de
commit a95f7b0402

View File

@@ -1,25 +0,0 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package ca.gosyer.util.system
import ca.gosyer.BuildConfig
import java.io.File
fun processFile() {
val pidFile = ProcessHandle.current().pid()
val strTmp = System.getProperty("java.io.tmpdir")
val file = File("$strTmp/${BuildConfig.NAME}.pid")
// backup deletion
if (file.exists()) {
file.delete()
}
file.writeText(pidFile.toString())
file.deleteOnExit()
}