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.

Offer only the caches in a Godot project's .godot, never its export credentials

Țugui Dragoșcddd5839d82a
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index 2ea88a63..0fffd8a2 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -331,9 +331,14 @@ public enum ProjectArtifacts {
name: "DerivedDataCache", markers: ["*.uproject"], tool: "Unreal Engine", isGeneric: false,
source: "https://dev.epicgames.com/documentation/en-us/unreal-engine/unreal-engine-directory-structure"
),
+ // `.godot` itself also holds the export passwords and keys (`export_credentials.cfg`), kept nowhere else.
Definition(
- name: ".godot", markers: ["project.godot"], tool: "Godot", isGeneric: false,
- source: "https://docs.godotengine.org/en/stable/tutorials/best_practices/version_control_systems.html"
+ name: ".godot/imported", markers: ["project.godot"], tool: "Godot", isGeneric: false,
+ source: "https://docs.godotengine.org/en/stable/tutorials/assets_pipeline/import_process.html"
+ ),
+ Definition(
+ name: ".godot/shader_cache", markers: ["project.godot"], tool: "Godot", isGeneric: false,
+ source: "https://github.com/godotengine/godot/blob/232e6b14abf6e590b41d60f11704e42de22bff72/main/main.cpp#L2113-L2116"
),
Definition(
name: ".import", markers: ["project.godot"], tool: "Godot", isGeneric: false,
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index 4405c473..a085b164 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -272,7 +272,8 @@ struct ProjectArtifactsTests {
Kind(artifact: "Binaries", marker: "Game.uproject", tool: "Unreal Engine", isGeneric: true),
Kind(artifact: "Intermediate", marker: "Game.uproject", tool: "Unreal Engine", isGeneric: true),
Kind(artifact: "DerivedDataCache", marker: "Game.uproject", tool: "Unreal Engine", isGeneric: false),
- Kind(artifact: ".godot", marker: "project.godot", tool: "Godot", isGeneric: false),
+ Kind(artifact: ".godot/imported", marker: "project.godot", tool: "Godot", isGeneric: false),
+ Kind(artifact: ".godot/shader_cache", marker: "project.godot", tool: "Godot", isGeneric: false),
Kind(artifact: ".import", marker: "project.godot", tool: "Godot", isGeneric: false),
Kind(artifact: "bin", marker: "App.csproj", tool: ".NET", isGeneric: true),
Kind(artifact: "obj", marker: "Library.fsproj", tool: ".NET", isGeneric: true),
@@ -333,6 +334,21 @@ struct ProjectArtifactsTests {
#expect(found.allSatisfy { $0.tool == "sbt" })
}
+ @Test func offersGodotsCachesAndNeverItsExportCredentials() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("game/project.godot", bytes: 16)
+ try directory.file("game/.godot/imported/icon.svg-org-example.ctex", bytes: 400_000)
+ try directory.file("game/.godot/shader_cache/CanvasShaderRD/org-example.cache", bytes: 400_000)
+ try directory.file("game/.godot/editor/filesystem_cache10", bytes: 16)
+ try directory.file("game/.godot/export_credentials.cfg", bytes: 16)
+ try age(directory.url, days: 60)
+
+ let found = await ProjectArtifacts.scan(roots: [directory.url]).artifacts
+
+ #expect(Set(found.map(\.name)) == [".godot/imported", ".godot/shader_cache"])
+ #expect(found.allSatisfy { $0.isRecommended })
+ }
+
@Test func findsRailsCacheInsideItsTemporaryFolderAndOnlyThere() async throws {
let directory = try TemporaryDirectory()
try directory.file("shop/config/application.rb", bytes: 16)
diff --git a/SAFETY.md b/SAFETY.md
index 63204c0d..96ec4923 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -320,7 +320,9 @@ Build Artifacts recommends what a build or a package manager makes again from th
includes `node_modules` and `Pods`, which `npm install` and `pod install` put back from the project's `package.json` and
`Podfile`. A Python environment (`.venv`, `venv`) is listed and never selected, since packages are often installed into
one by hand, and so is Terraform's `.terraform`, which keeps the workspace you chose. A folder whose name says nothing
-on its own, such as `target` or `build`, is listed and never selected either. Build Artifacts never searches a hidden
+on its own, such as `target` or `build`, is listed and never selected either. Of a Godot project's `.godot`, only the
+caches Godot makes again are offered, `imported` and `shader_cache`: the folder also holds the export passwords and
+keys (`export_credentials.cfg`), which exist nowhere else. Build Artifacts never searches a hidden
folder, a Library, or a folder a tool fills, such as `node_modules`: apps and tools keep there what they install, as
an editor keeps each extension's `package.json` beside the `node_modules` it runs with. A folder chosen to search
that is one of those, or sits inside one, is refused with the reason.