fresc81 / node-winreg

node module that provides access to the Windows Registry through the REG commandline tool
212 stars 58 forks source link

#4: Actually delete key when calling erase() #22

Closed spiffytech closed 8 years ago

spiffytech commented 8 years ago
justinmchase commented 8 years ago

/va appears to be a valid argument to reg delete:

/va        delete all values under this key.

What were you trying to do that this was causing a problem?

spiffytech commented 8 years ago

/va deletes the contents of the key, but leaves the key itself in place. This does not match the stated behavior of erase in the README, which claims erase deletes a key.

Further, without this patch, it's not clear that winreg can delete a key at all (i.e., it's unclear if remove can substitute for the patched [stated] behavior of erase).

I'm trying to pass winreg a path and have that registry entry and all of its children nuked.

justinmchase commented 8 years ago

So without /va if a key has values the key and all of the values are deleted? Sounds :+1: to me then.

fresc81 commented 8 years ago

I think /VA only deletes the values. Should we use an additional method to delete keys and just update the docs for erase? I don't want to break the behaviour of this method in case it leads to problems with existing programs that depend on that behaviour.

fresc81 commented 8 years ago

It's also already implemented in the tests-docs branch. https://github.com/fresc81/node-winreg/blob/tests-docs/lib/registry.js#L663

feross commented 8 years ago

Can this be merged? I need this behavior in my program.

You don't need to worry about breaking existing code. That's what semantic versioning is for. Release it as version 2.0.0.

feross commented 8 years ago

I just sent a fresh PR that merges cleanly to fix this. Just tested it and it works perfectly :dizzy:

https://github.com/fresc81/node-winreg/pull/33