Skip to content

Commit 1c7928b

Browse files
authored
Merge pull request #7 from SvalTek/develop
Add quarantine clean mode and custom keeplists with UI selection and enhancements
2 parents a8a87a7 + f984bf4 commit 1c7928b

5 files changed

Lines changed: 881 additions & 1643 deletions

File tree

README.md

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
ModCleaner is a small desktop utility for cleaning a game folder with a simple keep-list.
88

9-
It works by comparing the current contents of a game directory against a `#keeplist.txt` file. Anything not covered by the keeplist is treated as removable. This makes it useful for returning a heavily modded game install to a known-good state without manually sorting through every file.
9+
It works by comparing the current contents of a game directory against the active keeplist file. By default that file is `#keeplist.txt`. If a keeplist prefix is active, the file becomes `#<prefix>-keeplist.txt`. Anything not covered by the active keeplist is treated as removable. This makes it useful for returning a heavily modded game install to a known-good state without manually sorting through every file.
1010

1111
## What It Does
1212

@@ -18,13 +18,16 @@ ModCleaner provides three main actions:
1818

1919
### Generate Keeplist
2020

21-
Creates or overwrites `#keeplist.txt` inside the selected game folder.
21+
Creates or overwrites the active keeplist inside the selected game folder.
2222

2323
The generated file contains the current folder contents as relative paths. In other words, it takes a snapshot of what exists right now and treats those paths as files to preserve later.
2424

25+
> [!IMPORTANT]
26+
> `Generate Keeplist` overwrites the active keeplist file. If you maintain manual keep rules or `!rename` directives, keep a copy or re-add them after generating.
27+
2528
### Scan
2629

27-
Reads `#keeplist.txt`, evaluates the keep rules, and shows:
30+
Reads the active keeplist, evaluates the keep rules, and shows:
2831

2932
- planned file removals
3033
- planned rename operations
@@ -35,17 +38,25 @@ Reads `#keeplist.txt`, evaluates the keep rules, and shows:
3538

3639
Applies the current cleanup plan:
3740

38-
- deletes files not covered by the keeplist
41+
- removes files not covered by the keeplist
3942
- applies any valid `!rename` directives
40-
- removes empty parent directories left behind by deleted files
43+
- removes empty parent directories left behind by removed files
44+
45+
`Clean` supports two modes:
46+
47+
- `Delete` permanently removes files
48+
- `Quarantine` moves files into `.modcleaner_quarantine/<timestamp>/` inside the selected game folder
49+
50+
Neither mode uses the OS recycle bin.
4151

42-
`Clean` is destructive. Deleted files are not moved to a recycle bin.
52+
> [!WARNING]
53+
> `Delete` permanently removes files. `Quarantine` is safer because it moves removable files into `.modcleaner_quarantine/<timestamp>/`, but it is not a full rollback system.
4354
4455
## Intended Workflow
4556

4657
1. Select your game folder.
4758
2. Run `Generate Keeplist` to capture the current files.
48-
3. Edit `#keeplist.txt` if needed.
59+
3. Edit the active keeplist if needed.
4960
4. Run `Scan` to review what would happen.
5061
5. Run `Clean` only after confirming the scan output.
5162

@@ -59,22 +70,45 @@ A common pattern is:
5970

6071
This tool is snapshot-based.
6172

62-
That means if you install new mods or add files after generating `#keeplist.txt`, those new files are not automatically preserved. If you want to keep them, you must either:
73+
> [!IMPORTANT]
74+
> If you add mods or other files after generating the active keeplist, those files are not automatically preserved. Regenerate the keeplist or add keep rules manually before cleaning.
75+
76+
If you want to keep them, you must either:
6377

6478
- regenerate the keeplist, or
6579
- add keep rules manually
6680

6781
Also:
6882

69-
- `#keeplist.txt` is never deleted by the cleaner
70-
- `Scan` requires a valid `#keeplist.txt`
71-
- `Clean` requires a valid `#keeplist.txt`
83+
- keeplist files matching `#keeplist.txt` or `#<prefix>-keeplist.txt` are never deleted by the cleaner.
84+
- `Scan` requires a valid active keeplist
85+
- `Clean` requires a valid active keeplist
7286
- an empty keeplist is treated as an error
7387
- file ordering and planning are deterministic
7488

89+
### Keeplist Prefixes
90+
91+
ModCleaner supports an optional in-memory keeplist prefix system.
92+
93+
- default keeplist: `#keeplist.txt`
94+
- prefixed keeplist: `#<prefix>-keeplist.txt`
95+
96+
The prefix UI is intentionally hidden behind `Ctrl+K`. This is to avoid confusion for users who just want a single keeplist file.
97+
If you want to use prefixes, press `Ctrl+K` and enter a prefix to switch to a different keeplist file. You can have as many keeplist files as you want, but only one is active at a time.
98+
99+
> [!NOTE]
100+
> Keeplist prefixes are an advanced feature. They do not add extra scanning behavior; they only change which keeplist filename `Generate`, `Scan`, and `Clean` use.
101+
102+
Rules:
103+
104+
- prefixes are stored in memory only
105+
- an empty prefix returns to `#keeplist.txt`
106+
- valid prefixes may contain only letters, numbers, `_`, and `-`
107+
- invalid prefixes are rejected and do not change the active keeplist
108+
75109
## Keeplist Format
76110

77-
`#keeplist.txt` is line-based.
111+
The active keeplist is line-based.
78112

79113
Blank lines are ignored.
80114

@@ -150,7 +184,11 @@ A rename can end in one of these states:
150184

151185
Other rename I/O failures are fatal.
152186

153-
There is no rollback for partial progress during `Clean`. (This is why `Scan` is important to review beforehand. This may be improved in the future.)
187+
There is no automatic rollback for partial progress during `Clean`.
188+
189+
In `Delete` mode, removed files are gone unless you have your own backup or can restore them another way.
190+
191+
In `Quarantine` mode, removed files are moved into `.modcleaner_quarantine/<timestamp>/`, which gives you a manual recovery path, but rename operations and other partial-progress cases are still not rolled back automatically.
154192

155193
## Example Keeplist
156194

@@ -168,11 +206,14 @@ mods/**
168206

169207
Review the scan output before cleaning.
170208

171-
This tool permanently deletes files that are not matched by the keeplist. It is best used when:
209+
> [!WARNING]
210+
> `Scan` is the review step. `Clean` applies the current plan and does not provide automatic rollback for partial progress.
211+
212+
This tool can permanently delete files that are not matched by the keeplist. It is best used when:
172213

173214
- you understand the folder you are targeting
174-
- you have a backup or can re-verify game files if needed
175-
- you have reviewed `#keeplist.txt`
215+
- you have a backup, can re-verify game files, or are intentionally using quarantine mode
216+
- you have reviewed the active keeplist
176217

177218
## Development
178219

@@ -203,4 +244,4 @@ ModCleaner is a deterministic keep-list cleaner for game folders.
203244

204245
It does not try to detect which files are mods automatically. Instead, it gives you a simple rule:
205246

206-
If a file is not covered by `#keeplist.txt`, it is removable.
247+
If a file is not covered by the active keeplist, it is removable.

0 commit comments

Comments
 (0)