mgrLM // Simplify userDataFolderExists().

This commit is contained in:
ShikiSuen 2022-05-21 14:55:10 +08:00
parent b781400f45
commit b84fe50964
2 changed files with 4 additions and 5 deletions

View File

@ -302,7 +302,7 @@ extension ctlInputMethod {
}
@objc func openUserDataFolder(_: Any?) {
if !mgrLangModel.checkIfUserDataFolderExists() {
if !mgrLangModel.userDataFolderExists {
return
}
NSWorkspace.shared.openFile(

View File

@ -271,7 +271,7 @@ enum mgrLangModel {
}
static func chkUserLMFilesExist(_ mode: InputMode) -> Bool {
if !checkIfUserDataFolderExists() {
if !userDataFolderExists {
return false
}
if !ensureFileExists(userPhrasesDataPath(mode))
@ -309,9 +309,8 @@ enum mgrLangModel {
return true
}
//
//
static func checkIfUserDataFolderExists() -> Bool {
//
static var userDataFolderExists: Bool {
let folderPath = mgrLangModel.dataFolderPath(isDefaultFolder: false)
var isFolder = ObjCBool(false)
var folderExist = FileManager.default.fileExists(atPath: folderPath, isDirectory: &isFolder)