• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

macOSのスクリーンショットの保存場所を変更するメニュバーエクストラ


Commit MetaInfo

Revision8a1c5a21267791dae4ac4061e1efc8932c390e21 (tree)
Time2017-11-05 09:18:20
Authormasakih <masakih@user...>
Commitermasakih

Log Message

起動時に保存フォルダが変わってしまう問題を修正

Change Summary

Incremental Difference

--- a/GoInto/StatusBar.swift
+++ b/GoInto/StatusBar.swift
@@ -31,7 +31,7 @@ final class StatusBar: NSObject {
3131 FolderItem(desktopURL()),
3232 FolderItem(picturesURL()),
3333 SeparatorItem(),
34- ChooseFolderItem(appendFolder),
34+ ChooseFolderItem(appendAndChooseFolder),
3535 SeparatorItem(),
3636 ImageTypeItem(),
3737 SeparatorItem(),
@@ -45,11 +45,23 @@ final class StatusBar: NSObject {
4545 appendFolder(Screenshot.shared.location)
4646 }
4747
48- private func appendFolder(_ url: URL) {
48+ private func newFolderItem(_ url: URL) -> FolderItem? {
49+
50+ guard url != desktopURL() else { return nil }
51+ guard url != picturesURL() else { return nil }
52+
4953 let newItem = FolderItem(url)
5054 recentItems.append(newItem)
5155 newItem.enter(menu)
52- newItem.set()
56+ return newItem
57+ }
58+
59+ private func appendFolder(_ url: URL) {
60+ _ = newFolderItem(url)
61+ }
62+
63+ private func appendAndChooseFolder(_ url: URL) {
64+ newFolderItem(url)?.set()
5365 }
5466 }
5567