bleachbit icon indicating copy to clipboard operation
bleachbit copied to clipboard

Custom rule (in preferences) does not support environment variables

Open Josebalch opened this issue 4 months ago • 1 comments

Describe the bug Custom rules with environment variables don't work.

To Reproduce

  1. Go to settings>custom clean
  2. Click on add folder or file
  3. Use a path with environment variables
  4. It gets added with the translated absolute path, instead of env var.

Instead, if you type it manually en bleachbit.ini, for example:

13_type = folder
13_path = %LocalAppData%\Plex Media Server\Logs

It gets added to the GUI list correctly:

Image

BUT, it doesn't find the path when running cleaner:

Image

The error happens every time.

Expected behavior The path should be added using env vars when using the GUI, and they should be found when running the cleaner.

Desktop:

  • OS: Windows 11 Pro 24H2
  • BleachBit version 5.0.0 stable

Josebalch avatar Oct 16 '25 11:10 Josebalch

I changed the title to clarify the concern. Yes, it's not supported to use environment variables. Instead, it's expected that the user uses the GUI to select specific files or folders.

Until then, consider making a CleanerML file. Below is an untested starting point. Run preview and check carefully

<?xml version="1.0" encoding="UTF-8"?>
<cleaner id="plex_media_server" version="1.0">
  <label>Plex Media Server</label>
  <description>Deletes logs and cache from Plex Media Server.</description>
  <option id="logs" label="Logs">
    <description>Deletes all server log files.</description>
    <action type="delete" search="walk.files" path="$localappdata\Plex Media Server\Logs\" />
  </option>
</cleaner>

az0 avatar Oct 16 '25 14:10 az0