GithubHelp home page GithubHelp logo

Comments (2)

tiemay avatar tiemay commented on July 21, 2024

I thought a solution could be to separate win/linux cleaners by setting <cleaner id="virtualbox" os="windows"> and <cleaner id="virtualbox" os="linux">.
But if I do that and both files are in the cleaners folder (on Windows) both actions are run. Resulting in the same issue.

I imagine having multiple cleaners with the same id could be problematic. Also, I'm not sure if using Linux paths on windows is intentional or not. The documentation under "Testing the cleaner" says to never use ~ in windows. Yet, the gimp cleaner uses it and otherwise wouldn't currently be working on windows. A clarification on this matter has been requested in launchpad #1366662. Until this behaviour is clarified, I wouldn't make or accept any pull requests related to this issue; You're proposing a pretty big change to how cleaners are written when it might just be a simple bug that lets ~ or / be used on windows.

If we are going to separate actions based on os via CleanerML though, I suggest something like this:

<cleaner id="foo">
  <label>bar</label>
  <description>baz</description>
  <option id="logs">
    <label>Logs</label>
    <description>Delete the logs</description>
    <group os="linux">
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
    </group>
    <group os="windows">
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
      <action command="delete" search="walk.files" path="..."/>
    </group>
  </option>
</cleaner>

Possibly along with:

<cleaner id="foo">
  <label>bar</label>
  <description>baz</description>
  <option id="logs">
    <label>Logs</label>
    <description>Delete the logs</description>
    <action os="linux" command="delete" search="walk.files" path="..."/>
    <action os="windows" command="delete" search="walk.files" path="..."/>
  </option>
</cleaner>

for small options with only a couple actions.

This way we wouldn't need to create a new cleaner.xml file for each os, thus the cleaner id, labels, descriptions, and option id's would all be reused, keeping the code DRYer.

I'd like to hear @az0's take on this though.

from bleachbit.

az0 avatar az0 commented on July 21, 2024

In general specifying a path for the operating system (e.g., such as ~/.config/.. on Windows) is harmless because it does not exist. There is a tiny performance penalty checking whether the file exists. This is how things have worked so far.

Recent commits have added multi-value variables that support the DRY principle that @tiemay mentioned.

Still, I'll add a os= option for action.

from bleachbit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.