Add a Save As location preference (#145)
Add a General preferences option controlling where the Save As panel opens: the last used folder (default), the same folder as the imported file, or a custom folder chosen by the user.
This commit is contained in:
1 parent
151530d6ab
commit
c8fb950854
5 files changed
+172
-4
No files matched your search
@@ -55,6 +55,19 @@ final class SaveOptions: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
/// The folder the save panel should open at, or nil to leave it
|
||||
/// at the last folder used.
|
||||
private func preferredDirectory(for doc: Document) -> URL? {
|
||||
switch Prefs.saveAsLocation {
|
||||
case .lastUsed:
|
||||
return nil
|
||||
case .sameAsFile:
|
||||
return doc.fileURL?.deletingLastPathComponent() ?? doc.mp4.preferredFileDirectory()
|
||||
case .custom:
|
||||
return Prefs.saveAsCustomLocation
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@@ -70,6 +83,10 @@ final class SaveOptions: NSViewController {
|
||||
savePanel?.nameFieldStringValue = filename
|
||||
}
|
||||
|
||||
if let directory = preferredDirectory(for: doc) {
|
||||
savePanel?.directoryURL = directory
|
||||
}
|
||||
|
||||
setFileType(filenameExtension: fileType)
|
||||
|
||||
_64bit_data.state = Prefs.mp464bitOffset ? .on : .off
|
||||
|
||||
Reference in new issue
Block a user