Skip to content

Commit

Permalink
Fix data format (#105)
Browse files Browse the repository at this point in the history
* Allow opening of `public.item` instead of `public.source-code`

* Handle errors
  • Loading branch information
pkasila authored Mar 19, 2022
1 parent b73c8e7 commit 2f28f63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions CodeEdit/Documents/CodeEditDocumentController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ extension NSDocumentController {
dialog.begin { result in
if result == NSApplication.ModalResponse.OK, let url = dialog.url {
self.openDocument(withContentsOf: url, display: true) { document, documentWasAlreadyOpen, error in
// TODO: handle errors
if let error = error {
print("Error: \(error.localizedDescription)")
NSAlert(error: error).runModal()
return
}

guard let document = document else {
print("Error: Failed to get document")
let alert = NSAlert()
alert.messageText = NSLocalizedString("Failed to get document",
comment: "Failed to get document")
alert.runModal()
return
}
var recentProjectPaths: [String] = UserDefaults.standard.array(
Expand Down
2 changes: 1 addition & 1 deletion CodeEdit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.source-code</string>
<string>public.item</string>
</array>
<key>NSDocumentClass</key>
<string>CodeFileDocument</string>
Expand Down

0 comments on commit 2f28f63

Please sign in to comment.