From 84003793d71b328437e7c381b0089e4bcf8b88df Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 9 Apr 2022 14:56:53 +0800 Subject: [PATCH] ctlPrefWindow // Append trailing slash to the path read by ComDlg32. - Already patched in the incoming Dictionary pane of the PrefUI. --- Source/WindowControllers/ctlPrefWindow.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/WindowControllers/ctlPrefWindow.swift b/Source/WindowControllers/ctlPrefWindow.swift index 5c3fd242..d4489122 100644 --- a/Source/WindowControllers/ctlPrefWindow.swift +++ b/Source/WindowControllers/ctlPrefWindow.swift @@ -266,10 +266,12 @@ import Cocoa IME.dlgOpenPath.beginSheetModal(for: self.window!) { result in if result == NSApplication.ModalResponse.OK { if IME.dlgOpenPath.url != nil { - if mgrLangModel.checkIfSpecifiedUserDataFolderValid( - IME.dlgOpenPath.url!.path) - { - mgrPrefs.userDataFolderSpecified = IME.dlgOpenPath.url!.path + // CommonDialog 讀入的路徑沒有結尾斜槓,這會導致檔案目錄合規性判定失準。 + // 所以要手動補回來。 + var newPath = IME.dlgOpenPath.url!.path + newPath.ensureTrailingSlash() + if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) { + mgrPrefs.userDataFolderSpecified = newPath IME.initLangModels(userOnly: true) } else { clsSFX.beep()