     @objc private func createLivePhoto(sender: AnyObject?) {
         guard let image = posterFrameView.image else { return }
 
-        let outputDir = NSURL(fileURLWithPath: NSHomeDirectory()).URLByAppendingPathComponent("Pictures/LoveLiver")
         guard let _ = try? NSFileManager.defaultManager().createDirectoryAtPath(outputDir.path!, withIntermediateDirectories: true, attributes: nil) else { return }
 
         let assetIdentifier = NSUUID().UUIDString

            dispatch_async(dispatch_get_main_queue()) {
                switch session.status {
                case .Completed:
                    NSLog("%@", "exportAsynchronouslyWithCompletionHandler = \(session.status)")

                    JPEG(path: tmpImagePath).write(imagePath, assetIdentifier: assetIdentifier)
                    NSLog("%@", "LivePhoto JPEG created: \(imagePath)")
                    NSWorkspace.sharedWorkspace().selectFile(imagePath, inFileViewerRootedAtPath: "")

                    QuickTimeMov(path: tmpMoviePath).write(moviePath, assetIdentifier: assetIdentifier)
                    NSLog("%@", "LivePhoto MOV created: \(moviePath)")
                    NSWorkspace.sharedWorkspace().selectFile(moviePath, inFileViewerRootedAtPath: "")
                case .Cancelled, .Exporting, .Failed, .Unknown, .Waiting:
                    NSLog("%@", "exportAsynchronouslyWithCompletionHandler = \(session.status)")
                }
            }
        }
    }
}

import AVKit
import NorthLayout
import Ikemen


private let outputDir = NSURL(fileURLWithPath: NSHomeDirectory()).URLByAppendingPathComponent("Pictures/LoveLiver")


class MovieDocumentViewController: NSViewController {
