• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

SWFファイル内の画像を表示/書き出しするGUIツール


Commit MetaInfo

Revision184a680a2c7b3759066c9617a4dabef64ebb1532 (tree)
Zeit2016-10-02 20:59:31
Autormasakih <masakih@user...>
Commitermasakih

Log Message

例外の処理方法を変更

Ändern Zusammenfassung

Diff

--- a/KoreNoKaraSu/HMSwfDocument.swift
+++ b/KoreNoKaraSu/HMSwfDocument.swift
@@ -108,14 +108,19 @@ class HMSwfDocument: NSDocument {
108108 guard $0 != NSModalResponseCancel else { return }
109109
110110 if FileManager().fileExists(atPath: panel.url!.path) {
111- guard let _ = try? FileManager().removeItem(at: panel.url!) else {
111+ do {
112+ try FileManager().removeItem(at: panel.url!)
113+ } catch {
112114 Swift.print("Fail to remove item.")
113115 return
114116 }
115117 }
116- guard let _ = try? FileManager().copyItem(at: target.url, to: panel.url!) else {
118+
119+ do {
120+ try FileManager().copyItem(at: target.url, to: panel.url!)
121+ } catch {
117122 Swift.print("Fail to copy item")
118- return
123+
119124 }
120125 }
121126 }
--- a/KoreNoKaraSu/HMTemporaryDirectory.swift
+++ b/KoreNoKaraSu/HMTemporaryDirectory.swift
@@ -17,16 +17,18 @@ struct HMTemporaryDirectory {
1717
1818 init(name: String) throws {
1919 let tempDir: URL
20- let o = NSTemporaryDirectory()
20+ let t = NSTemporaryDirectory()
2121 if let identifier = Bundle.main.bundleIdentifier {
22- tempDir = URL(fileURLWithPath: o).appendingPathComponent(identifier)
22+ tempDir = URL(fileURLWithPath: t).appendingPathComponent(identifier)
2323 } else {
24- tempDir = URL(fileURLWithPath: o).appendingPathComponent("KoreNoKaraSu")
24+ tempDir = URL(fileURLWithPath: t).appendingPathComponent("KoreNoKaraSu")
2525 }
2626
2727 url = tempDir.appendingPathComponent(name)
2828
29- guard let _ = try? FileManager().createDirectory(at: url, withIntermediateDirectories: true, attributes: nil) else {
29+ do {
30+ try FileManager().createDirectory(at: url, withIntermediateDirectories: true, attributes: nil)
31+ } catch {
3032 print("Can not create directory \(url.path)")
3133 throw HMTemporaryDirectoryError.CoanNotCreateDirectory
3234 }