Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Keep a debug render from starting Peel's work

Țugui Dragoș41c1e1a60603
diff --git a/Peel/HomeSnapshot.swift b/Peel/HomeSnapshot.swift
index fa7352dc..a45393db 100644
--- a/Peel/HomeSnapshot.swift
+++ b/Peel/HomeSnapshot.swift
@@ -8,8 +8,10 @@ import SwiftUI
/// the menu bar panel on the paper it draws itself, and Home on the window's plain color, since `ImageRenderer` does
/// not draw glass.
enum HomeSnapshot {
+ static let directory = ProcessInfo.processInfo.environment["PEEL_SNAPSHOT"]
+
static func runIfRequested() async {
- guard let directory = ProcessInfo.processInfo.environment["PEEL_SNAPSHOT"] else { return }
+ guard let directory else { return }
let home = HomeModel()
let helper = HelperModel()
let stats = LifetimeStats()
diff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swift
index 32433cf3..45abc194 100644
--- a/Peel/PeelApp.swift
+++ b/Peel/PeelApp.swift
@@ -276,6 +276,10 @@ struct PeelApp: App {
/// Starts what Peel does from launch to quit, from whichever shows first: the main window, or the menu bar item.
/// Each piece starts once, and none is a child of the view that called it, so closing the window stops nothing.
private func start() {
+ #if DEBUG
+ // A render or an export only draws and quits, so it contacts nothing and writes nothing of Peel's.
+ guard HomeSnapshot.directory == nil, TerminalExport.directory == nil else { return }
+ #endif
Navigator.shared.openWindow = openWindow
background.start([
followFolders, followAppsForTheTrash, askWhenDue, followFindings, followActivations, watchFreeSpace,
diff --git a/Peel/TerminalExport.swift b/Peel/TerminalExport.swift
index 81e419b0..38eb88af 100644
--- a/Peel/TerminalExport.swift
+++ b/Peel/TerminalExport.swift
@@ -4,8 +4,10 @@ import SwiftUI
#if DEBUG
enum TerminalExport {
+ static let directory = ProcessInfo.processInfo.environment["PEEL_TERMINAL_EXPORT"]
+
static func runIfRequested() {
- guard let directory = ProcessInfo.processInfo.environment["PEEL_TERMINAL_EXPORT"] else { return }
+ guard let directory else { return }
let themes = URL(filePath: directory).appending(path: "Themes", directoryHint: .isDirectory)
let renders = URL(filePath: directory).appending(path: "Renders", directoryHint: .isDirectory)
let prompts = URL(filePath: directory).appending(path: "Prompts", directoryHint: .isDirectory)