Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import Foundation
extension ConfigStore { public static let defaultFileContents = """ #:schema \(ConfigJSONSchema.publishedURL) version = 1
[general] shortcuts-enabled = true collect-activity = true when-display-full = "swap"
[motion] highlight = "active" highlight-width = 2.0
[appearance] stack-controls = "on-demand" palette = "system" mode = "system" border-opacity = 1.0
[focus-modes] no-peek-level = 0.25 no-peek-blur = true clean-space-color = "graphite"
[mouse] focus-follows-mouse = false focus-delay = 0.35 typing-cooldown = 1 edge-snapping = true drop-to-ratio = true
"""
public func createDefaultFileIfMissing() throws { switch ConfigFileContents.read(from: fileURL) { case .bytes: return case .failure(let diagnostic): throw diagnostic case .missing: break } try FileManager.default.createDirectory( at: fileURL.deletingLastPathComponent(), withIntermediateDirectories: true ) do { try Data(Self.defaultFileContents.utf8).write(to: fileURL, options: .withoutOverwriting) } catch let error as CocoaError where error.code == .fileWriteFileExists { // An editor or another startup may have created the file after our read. switch ConfigFileContents.read(from: fileURL) { case .bytes: return case .failure(let diagnostic): throw diagnostic case .missing: throw error } } }}