Git Product home page Git Product logo

Comments (22)

emersonrp avatar emersonrp commented on September 14, 2024

I've pondered this from time to time. I've always shied away a little bit from deleting files programmatically because bugs in such code spell disaster. That said, I might take a look at what it would take to do this safely, because I agree with the "unsightly" nature of leaving old unused files around.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

I'm leaning toward the tedious process of actually looking for each individual file BC might ever write, and deleting them one-by-one, instead of doing a scary directory-scale deletion. This would also avoid deleting any other stuff people were intentionally keeping in their binds directory. Over in #52 it came up obliquely that people might be keeping things like window state files in there.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

Starting in on this and already seeing some strange corner cases I'll need to handle -- if someone has a complex bind that they've written out, and then delete that custom bind from the profile, there's no trivial way to know about those files any more. Will probably leverage the innards of this so that when deleting a custom bind, the (already implemented) confirmation box will have an "also delete all associated bindfiles" checkbox on it.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

Shipped some of the infrastructure to implement this with v0.18.0.5 -- nothing at all visible yet but it contains code to generate a list of all files that BindControl manages / writes.

This list can then eventually be used, in whole or in parts, to do targeted deletion of these files.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

image
Does this seem like sane placement for a "Delete All Binds" button?

from bindcontrol.

xizar avatar xizar commented on September 14, 2024

I think so.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

OK, I have put out a prerelease that does this. I'm still a little nervous about deleting things, but I've jumped through several hoops to try to prevent it from going rogue. Please check it out carefully and let me know your luck.

https://github.com/emersonrp/bindcontrol/releases/tag/delete_binds_prerelease1

Edit: if this seems to be working well, there's still more work to be done before it's fully released -- I need to add "delete associated keybinds?" when deleting a Complex or Buffer bind, and possibly eventually a "delete all binds before writing binds" preference.

from bindcontrol.

xizar avatar xizar commented on September 14, 2024

I wonder how meaningful a list of bind files would be, to give some suggestion of what's responsible for what. I have a flying blaster that has ~950 bind files written and a flying Mastermind (with pet binds) writing ~650 files, which seems odd.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

That list exists now, and could be surfaced. For the Speed-on-Demand tab, the list is -thousands- of files long, as there are many permutations. Without taking into consideration the small sprinkling of files that Complex Binds and Buffer Binds create, there's over 15000 possible files currently. Still, I'm totally game to surface that info, maybe under the "Help" menu? "Show this Tab's possible files"? Or something? Not sure what the cleanest way is to present that without being intrusive for the 99% case where people don't need or want to see that.

Edit to add: A list of what files -would- be written by a given profile doesn't currently exist in exactly that form, oddly, but could with some small effort. It would be possible in that case to have a "Help" -> "Show BindFile Filenames" and see the list that "Write Binds" would create, grouped by tab.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

Or, would it be helpful to present that info behind a "See Filenames" button on the "done writing binds" dialog? I'm warming to that idea.

from bindcontrol.

xizar avatar xizar commented on September 14, 2024

Are user-friendly docs floating somewhere around that describe what each directory's for? cbinds and mmbinds are kind of obvious, but an alternative to listing out all the 15k files, might be an explanation of the directory structure.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

I could make such a doc and stick it under the Help menu. Also my notion of "See Filenames" would be showing only the few hundred that were written out. I'll angle toward doing both.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

Added a high-level overview of the files/subdirs to the "Help" menu on the prerelease branch:

https://github.com/emersonrp/bindcontrol/releases/tag/delete_binds_prerelease2

Still pondering the format/etc of adding a list of what was written to the write-binds result dialog. Could trivially just blat a big list of file paths into a scrolling text field, but it might be nice to format it a little bit for ease of reading.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

image
This is what I have so far. Might just ship it as-is, though I think the dialog could use some reordering and wording updates.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

This has now officially shipped with v0.19. Check it out.

https://github.com/emersonrp/bindcontrol/releases/tag/v0.19

from bindcontrol.

xizar avatar xizar commented on September 14, 2024

Some observations.

BindControl seems to have a list of files it has decided belong to it.

I loaded up a blaster profile and told it to delete binds straight away, without writing anything first. BC had already decided it knew what files it controlled.

It did not delete the character's, now empty, directory.

I copied the binds from a mastermind and put it into the blaster's directory (without writing new binds or changing profiles), and told it to delete binds. Bindcontrol deleted everything, including the non-blaster files (i.e., the MM pet binds).

I added a complex bind from within BC and deleting binds from within bc did not delete the cbinds folders or any of the files inside it that bc wrote.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

These are excellent observations, thanks.

BindControl seems to have a list of files it has decided belong to it.

Yes just so. The intent is to delete ALL possible binds, including debris left over from previous configurations (or bugs, like where the team select binds were being splatted out there unilaterally).

It did not delete the character's, now empty, directory.

That's a bug, will investigate. Assuming there's nothing left in there then yes, it should delete the profile directory.

I copied the binds from a mastermind and put it into the blaster's directory (without writing new binds or changing profiles), and told it to delete binds. Bindcontrol deleted everything, including the non-blaster files (i.e., the MM pet binds).

Yeah, that's working as intended. That's a bit of a pathological case, but you have the instincts of a software QA tester, hah. The intended behavior of the feature is to clean out everything from the profile directory that BindControl might possibly have written, even if the Profile were configured differently previously.

What it -doesn't- do is just BLAM remove the whole populated directory, because (a) that's a scary thing to do programmatically, and (b) there might be things BindControl didn't write being kept in there.

I added a complex bind from within BC and deleting binds from within bc did not delete the cbinds folders or any of the files inside it that bc wrote.

Oh that's also a bug. Hmm, that -was- working, sigh.

Complex and Buffer Binds are weird cases and still need some work -- currently if you delete a Complex Bind from the profile, for instance, BindControl loses track of the files that the bind originally wrote out. (Edit: this also applies to renaming a Custom Bind, which probably needs to rename the bindfiles on-disk.)

There's no trivial way to fix that (without bloating the profile with historical cruft). My intent is to make it so that deleting a Complex or Buffer Bind will offer, at that time, to delete all associated bind files.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

I added a complex bind from within BC and deleting binds from within bc did not delete the cbinds folders or any of the files inside it that bc wrote.

I'm not seeing this behavior, it removes everything just fine for me. I added a two-step Complex Bind, wrote out the binds, and then deleted all binds. Both steps' files and the cbinds directory were correctly deleted. Do you have a step-by-step to make this happen? Thanks.

I have a fix for the profile directory not being removed and will ship a bugfix release shortly.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

https://github.com/emersonrp/bindcontrol/releases/tag/v0.19.0.1

from bindcontrol.

xizar avatar xizar commented on September 14, 2024

I tried reproducing it and wasn't able to, either. I'm wondering if it was weirdness with file explorer not updating its window, as I was able to make a phantom version of the bug that persisted as long as I stayed in the cbind directory, but if I navigated out of it, it disappeared.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

OK cool. I'll keep it at the back of my head but I -think- it's working correctly, modulo the business where you delete a custom bind and BindControl loses track of those files. Could completely believe that having an Explorer window open inside cbinds could cause weirdness, possibly even Windows deciding that the directory is "in use" and disallowing it being removed, though it usually does the right thing in similar situations.

from bindcontrol.

emersonrp avatar emersonrp commented on September 14, 2024

OK, we now delete Complex and Buffer Binds' files on delete or rename of the associated bind.

I'm gonna close this issue since the spirit of "Keep the binds directory free of cruft" is now implemented, and we can open new issues if we find bugs in the implementation.

https://github.com/emersonrp/bindcontrol/releases/tag/v0.19.1

from bindcontrol.

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.