Repo // Ensure BookmarkMangager.
This commit is contained in:
parent
18596d5275
commit
f300305f85
|
@ -354,7 +354,7 @@ enum mgrLangModel {
|
||||||
folderPath?.ensureTrailingSlash()
|
folderPath?.ensureTrailingSlash()
|
||||||
}
|
}
|
||||||
let isFolderWritable = FileManager.default.isWritableFile(atPath: folderPath ?? "")
|
let isFolderWritable = FileManager.default.isWritableFile(atPath: folderPath ?? "")
|
||||||
|
// IME.prtDebugIntel("mgrLM: Exist: \(folderExist), IsFolder: \(isFolder.boolValue), isWritable: \(isFolderWritable)")
|
||||||
if ((folderExist && !isFolder.boolValue) || !folderExist) || !isFolderWritable {
|
if ((folderExist && !isFolder.boolValue) || !folderExist) || !isFolderWritable {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -423,6 +423,7 @@ enum mgrLangModel {
|
||||||
return userDictPathDefault
|
return userDictPathDefault
|
||||||
}
|
}
|
||||||
if mgrPrefs.ifSpecifiedUserDataPathExistsInPlist() {
|
if mgrPrefs.ifSpecifiedUserDataPathExistsInPlist() {
|
||||||
|
BookmarkManager.shared.loadBookmarks()
|
||||||
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(userDictPathSpecified) {
|
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(userDictPathSpecified) {
|
||||||
return userDictPathSpecified
|
return userDictPathSpecified
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -72,23 +72,23 @@ struct suiPrefPaneDictionary: View {
|
||||||
if let window = ctlPrefUI.shared.controller.window {
|
if let window = ctlPrefUI.shared.controller.window {
|
||||||
IME.dlgOpenPath.beginSheetModal(for: window) { result in
|
IME.dlgOpenPath.beginSheetModal(for: window) { result in
|
||||||
if result == NSApplication.ModalResponse.OK {
|
if result == NSApplication.ModalResponse.OK {
|
||||||
if IME.dlgOpenPath.url != nil {
|
guard let url = IME.dlgOpenPath.url else { return }
|
||||||
// CommonDialog 讀入的路徑沒有結尾斜槓,這會導致檔案目錄合規性判定失準。
|
// CommonDialog 讀入的路徑沒有結尾斜槓,這會導致檔案目錄合規性判定失準。
|
||||||
// 所以要手動補回來。
|
// 所以要手動補回來。
|
||||||
var newPath = IME.dlgOpenPath.url!.path
|
var newPath = url.path
|
||||||
newPath.ensureTrailingSlash()
|
newPath.ensureTrailingSlash()
|
||||||
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) {
|
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) {
|
||||||
mgrPrefs.userDataFolderSpecified = newPath
|
mgrPrefs.userDataFolderSpecified = newPath
|
||||||
tbxUserDataPathSpecified = mgrPrefs.userDataFolderSpecified
|
tbxUserDataPathSpecified = mgrPrefs.userDataFolderSpecified
|
||||||
IME.initLangModels(userOnly: true)
|
BookmarkManager.shared.saveBookmark(for: url)
|
||||||
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
|
IME.initLangModels(userOnly: true)
|
||||||
} else {
|
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
|
||||||
clsSFX.beep()
|
} else {
|
||||||
if !bolPreviousFolderValidity {
|
clsSFX.beep()
|
||||||
mgrPrefs.resetSpecifiedUserDataFolder()
|
if !bolPreviousFolderValidity {
|
||||||
}
|
mgrPrefs.resetSpecifiedUserDataFolder()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !bolPreviousFolderValidity {
|
if !bolPreviousFolderValidity {
|
||||||
|
|
|
@ -293,22 +293,22 @@ class ctlPrefWindow: NSWindowController {
|
||||||
|
|
||||||
IME.dlgOpenPath.beginSheetModal(for: window) { result in
|
IME.dlgOpenPath.beginSheetModal(for: window) { result in
|
||||||
if result == NSApplication.ModalResponse.OK {
|
if result == NSApplication.ModalResponse.OK {
|
||||||
if IME.dlgOpenPath.url != nil {
|
guard let url = IME.dlgOpenPath.url else { return }
|
||||||
// CommonDialog 讀入的路徑沒有結尾斜槓,這會導致檔案目錄合規性判定失準。
|
// CommonDialog 讀入的路徑沒有結尾斜槓,這會導致檔案目錄合規性判定失準。
|
||||||
// 所以要手動補回來。
|
// 所以要手動補回來。
|
||||||
var newPath = IME.dlgOpenPath.url!.path
|
var newPath = url.path
|
||||||
newPath.ensureTrailingSlash()
|
newPath.ensureTrailingSlash()
|
||||||
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) {
|
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) {
|
||||||
mgrPrefs.userDataFolderSpecified = newPath
|
mgrPrefs.userDataFolderSpecified = newPath
|
||||||
IME.initLangModels(userOnly: true)
|
BookmarkManager.shared.saveBookmark(for: url)
|
||||||
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
|
IME.initLangModels(userOnly: true)
|
||||||
} else {
|
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
|
||||||
clsSFX.beep()
|
} else {
|
||||||
if !bolPreviousFolderValidity {
|
clsSFX.beep()
|
||||||
mgrPrefs.resetSpecifiedUserDataFolder()
|
if !bolPreviousFolderValidity {
|
||||||
}
|
mgrPrefs.resetSpecifiedUserDataFolder()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !bolPreviousFolderValidity {
|
if !bolPreviousFolderValidity {
|
||||||
|
|
Loading…
Reference in New Issue