PoC: delete folder feature (Reference Only)#10
Conversation
ZeromusXYZ
left a comment
There was a problem hiding this comment.
Please address the bug regarding folder deletion when using
Edit -> Delete selected file ...
| } | ||
|
|
||
| private void MMEditDeleteFolder_Click(object sender, EventArgs e) | ||
| { |
There was a problem hiding this comment.
Indentation error.
On most of the functions you added btw.
| } | ||
|
|
||
| if (!(lbFiles.SelectedItem is FileListEntry fle)) | ||
| // --- NEW LOGIC START --- |
There was a problem hiding this comment.
While I get what your intention is here. This breaks the program functionality.
You will no longer be able to delete just 1 file from a "folder" as this check will take priority over the single file check.
You always have a folder node selected in tvFolders before you can even select a single file.
It's best to just revert this part of the code.
| return; | ||
| var filename = _currentFileViewFolder; | ||
| if (filename != "") filename += "/"; | ||
| filename += lbFiles.SelectedItem.ToString(); |
There was a problem hiding this comment.
Never just simply concat file paths by using string additions. Use Path.Combine() instead and account for the slash/backslash issue using replace.
| if (filename != "") filename += "/"; | ||
| filename += lbFiles.SelectedItem.ToString(); | ||
|
|
||
| if (!(lbFiles.SelectedItem is FileListEntry fle)) |
There was a problem hiding this comment.
You can write this as
if (lbFiles.SelectedItem is not FileListEntry fle)which is less confusing to read.
ZeromusXYZ
left a comment
There was a problem hiding this comment.
Functionality wise it now does indeed correctly use the file/directory if you picked the corresponding menu item.
However, you can not delete directories from the "Flat Folder View" tab this way.
| PreviewForm.Instance?.Close(); | ||
| return; | ||
| } | ||
| else |
There was a problem hiding this comment.
I don't know what editor you are using, but it's not a good one if it messes up indentations where you didn't even change code.
MMEditDeleteFolder_Click is it's own function now
|
updated title and changed to draft i think i fixed most of the issues. just sharing feature, i'll fix more if you want to add it to main. |
title