FSEventStreamHelper // Update path when necessary.

This commit is contained in:
ShikiSuen 2022-05-05 12:17:14 +08:00
parent 06d41f9216
commit 8eae5ecfe1
4 changed files with 8 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega
private var ctlAboutWindowInstance: ctlAboutWindow? // New About Window
private var checkTask: URLSessionTask?
private var updateNextStepURL: URL?
private var fsStreamHelper = FSEventStreamHelper(
public var fsStreamHelper = FSEventStreamHelper(
path: mgrLangModel.dataFolderPath(isDefaultFolder: false),
queue: DispatchQueue(label: "vChewing User Phrases")
)
@ -76,6 +76,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega
}
}
func updateStreamHelperPath() {
fsStreamHelper.path = mgrPrefs.userDataFolderSpecified
}
func showPreferences() {
if ctlPrefWindowInstance == nil {
ctlPrefWindowInstance = ctlPrefWindow.init(windowNibName: "frmPrefWindow")

View File

@ -37,7 +37,7 @@ public class FSEventStreamHelper: NSObject {
var id: FSEventStreamEventId
}
public let path: String
public var path: String
public let dispatchQueue: DispatchQueue
public weak var delegate: FSEventStreamHelperDelegate?

View File

@ -79,6 +79,7 @@ struct suiPrefPaneDictionary: View {
mgrPrefs.userDataFolderSpecified = newPath
tbxUserDataPathSpecified = mgrPrefs.userDataFolderSpecified
IME.initLangModels(userOnly: true)
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
} else {
clsSFX.beep()
if !bolPreviousFolderValidity {

View File

@ -276,6 +276,7 @@ class ctlPrefWindow: NSWindowController {
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) {
mgrPrefs.userDataFolderSpecified = newPath
IME.initLangModels(userOnly: true)
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
} else {
clsSFX.beep()
if !bolPreviousFolderValidity {