Skip to content

Commit

Permalink
fix a bug where exporting was only possible if export folder was alre…
Browse files Browse the repository at this point in the history
…ady present
  • Loading branch information
Patrick-Kladek committed Jan 30, 2018
1 parent 32f4420 commit ca97ee9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ final class ExportController {
func saveSingleImage(viewState: ViewState) -> [LayoutError] {
self.shouldCancel = false

let fileManager = FileManager()
let viewStateController = ViewStateController(viewState: viewState)
let layoutController = LayoutController(viewStateController: viewStateController, languageController: self.languageController, fileController: self.fileController)
guard let view = layoutController.layouthierarchy(layers: self.lastLayerState.layers) else { return [.noLayers] }

let data = view.pngData()
guard let url = self.fileController.outputURL(for: self.lastLayerState, viewState: viewState) else { return [.noOutputFile] }

try? fileManager.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true, attributes: nil)
try? data?.write(to: url, options: .atomic)

return layoutController.layoutErrors
Expand Down
4 changes: 2 additions & 2 deletions Screenshot Framer/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.3</string>
<string>0.3.1</string>
<key>CFBundleVersion</key>
<string>3</string>
<string>4</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
Expand Down

0 comments on commit ca97ee9

Please sign in to comment.