Ignore "file" if it's a folder

Wishlists for new functionality and features.
Post Reply
bnvbc
Posts: 9
Joined: 21 Apr 2019 16:58

Ignore "file" if it's a folder

Post by bnvbc »

First of all, let me thank you for creating HxD - I've been using it for years and tries lots of different HexEditors, but none of them works for me like yours does.
So I'm happy to see that you continue developing it.

I would like to propose several enhancements (I will open separate threads as it seems you use it like a bug tracker).
btw: Thank you for not using googlecaptcha during registration (but your blocklist for emails still sucks...).


Ignore "file" if it's a folder
I use HxD in conjunction with SpeedCommander (TotalCommander/MC alternative).
There I have a button to run other programs. It will give the selected files/folders via cmd to the starting program.
This works fine with HxD except for when one of those "files" is actually a folder. Then HxD will give an error message - this is obviously expected because it's not a file, but this is very annoying.

Please implement a check if the "file" to open via cmd args is actually a file, and if not, just silently ignore it.

Thank you
bnvbc
Posts: 9
Joined: 21 Apr 2019 16:58

Re: Ignore "file" if it's a folder

Post by bnvbc »

Yes/no/maybe?

You released several versions since then, why not include a one-line fix for this problem?
I'll even code it for you if you put the source on github.
Maël
Site Admin
Posts: 1366
Joined: 12 Mar 2005 14:15

Re: Ignore "file" if it's a folder

Post by Maël »

The reason is simply limited time. Even if you would write a "fix" on GitHub I would still have to review it/see if it interferes with other requests. Now back to topic.

So to summarize your request, you want HxD to ignore parameters that are folders and not files?

Why would you open HxD through SpeedCommander this way (with a folder parameter)? Do you use it as a kind of start menu?
What would other programs do with the folder, if they are not programs like a file explorer/FTP program and similar?
Maël
Site Admin
Posts: 1366
Joined: 12 Mar 2005 14:15

Re: Ignore "file" if it's a folder

Post by Maël »

I had a quick look at how Windows-Explorer handles this when you right click on a folder. "Open with HxD" will not be shown, so it makes a difference between folders and files. Maybe SpeedCommander should do so as well.

If I add your proposed solution, and HxD just starts without any error message/notification, it seems like hiding an issue that could affect other programs as well.

How does SpeedCommander know to execute HxD, does it use the registry to look up registered file extensions? Do you add it manually to the options. In the latter case, I think it should make the difference between folders and files.
bnvbc
Posts: 9
Joined: 21 Apr 2019 16:58

Re: Ignore "file" if it's a folder

Post by bnvbc »

Maël wrote: 07 Mar 2021 16:20 So to summarize your request, you want HxD to ignore parameters that are folders and not files?

Why would you open HxD through SpeedCommander this way (with a folder parameter)?
Hi, thank you for your reply.
SpeedCommander is an Explorer replacement (like TotalCommander) and lets me add custom buttons in the menu bar as a quick access.
SpeedCommander has two side-by-side panels with files/folders, so I can have for example drive C:\ in the left and D:\ in the right panel. Now clicking on my "HxD" button will open "HxD.exe" like this:

HxD.exe <paths-of-selected-items-left-panel> <paths-of-selected-items-right-panel>

This works perfectly fine if all paths are files, but it can happen that I have a folder selected in one of the panels (simply because I only use one panel to browse my files and the other still had some folder selected from something I did previously).
When one of those paths is a folder, it will give access denied error. Just like when you'd do "HxD.exe C:\Windows" in cmd for example.

So my proposal is to add a check if the given path is really a file and not a folder, and silently discard if folder:
https://stackoverflow.com/questions/636 ... -or-folder
Maël
Site Admin
Posts: 1366
Joined: 12 Mar 2005 14:15

Re: Ignore "file" if it's a folder

Post by Maël »

Thanks for clarifying. I also replied to your other posts, you might want to have a look.

Regarding this issue:
Okay, given your use case it makes more sense. Though, ignoring by default is still not that clean/expectable, as you might indeed want to open an entire folder in future. Or maybe compare folders, like WinMerge! I think adding an option --ignore-folder-params to HxD or similar is better.

Now one question remains. What if there are two folder params (or just folder params but no files), should HxD still open? I think in this case, an error message should appear, if only folders are passed in but no files. If however no other param than --ignore-folder-params is passed, HxD should just open silently.
bnvbc
Posts: 9
Joined: 21 Apr 2019 16:58

Re: Ignore "file" if it's a folder

Post by bnvbc »

Maël wrote: 11 Mar 2021 15:37 Though, ignoring by default is still not that clean/expectable, as you might indeed want to open an entire folder in future. Or maybe compare folders, like WinMerge! I think adding an option --ignore-folder-params to HxD or similar is better.
If something like this is planned, a switch/option certainly makes sense.
Now one question remains. What if there are two folder params (or just folder params but no files), should HxD still open? I think in this case, an error message should appear, if only folders are passed in but no files. If however no other param than --ignore-folder-params is passed, HxD should just open silently.
HxD should definitely open in my opinion, otherwise the user would have no feedback of what went "wrong".
A message box (unless prevented by the switch) would also make sense. Right now you get one, but with a different error that on first glance does not explain anything (access denied).
Post Reply