superfile icon indicating copy to clipboard operation
superfile copied to clipboard

Deleting a file with "ctrl+d" is not working on Windows11

Open wxutopia opened this issue 1 year ago • 1 comments

Describe the bug I use "ctrl+n" to create a new file in SPF. Then I use "ctrl+d" to delete the newly created file. But I can still see the file in SPF. I can also see the file in Windows file explorer.

System information (please complete the following information):

  • OS: [Windows11]
  • Version [22631.4169]
  • Superfile Version [v1.1.4]

wxutopia avatar Sep 15 '24 08:09 wxutopia

Yes. I met the same bug on win 11.

Zim-Inn avatar Oct 06 '24 15:10 Zim-Inn

duplicate of #335

Hettomei avatar Dec 11 '24 10:12 Hettomei

If you are using powershell can you check if there is any powershell hotkey conflict with ctrl+d?

yorukot avatar Dec 12 '24 04:12 yorukot

@yorukot I use powershell inside "Terminal Windows Version : 1.21.3231.0"
It is the same behavior with cmd.exe inside "Terminal Windows"

I don t have any ctrl-d hotkey configured. It print ^D

2024-12-12_09h20m03 (I put a screenshot in case you see something I don't see)

I also tested cmd.exe and WindowsPowerShell\v1.0\powershell.exe in the default windows console, nothing bind on ctrl-d :
I have the same behavior : ctrl-d display the confirm dialog, the process show the deleted file, but does not delete file.

Hettomei avatar Dec 12 '24 08:12 Hettomei

I have an occurence of this bug in a different way . Delete doesn't succeeds, and process is stuck at 0%

Image

But sure enough, delete of either files or directories is not working in Windows, and needs to be fixed.

lazysegtree avatar Jan 22 '25 17:01 lazysegtree

This is due to some issue in the trash library used https://github.com/rkoesters/xdg

Delete fails with this

2025/01/24 16:25:57 Paste item function move file to trash can error
2025/01/24 16:25:57 open C:\Users\nitin\.local\share\Trash\info\1.txt.trashinfo: The system cannot find the path specified.

Also this package has will move files to .local\share\Trash , and not the actual recycle bin of windows.

This can be a little bit confusing for windows users as the files they delete via Window explore goes to Recycle bin, but files deleted via superfile will go to some unknown location.

So, I am thinking of using this package for Windows - https://github.com/hymkor/trash-go For windows compatibility, the only other package I found was https://github.com/trubitsyn/go-recyclebin, but this is old and not maintained.

I have done a basic test of this.
package main

import (
    "fmt"
    "os"
    "github.com/hymkor/trash-go"
)

func main() {
    if len(os.Args) >= 2 {
        // Move files to the trash
        err := trash.Throw(os.Args[1])
        if err != nil {
            fmt.Fprintln(os.Stderr, "Error:", err)
            os.Exit(1)
        } else {
            fmt.Println("Files moved to Recycle Bin successfully.")
        }
    } else {
        fmt.Println("No files specified.")
    }
}

Initial stage of bin Image

Sample code Image

Afterwards Image

@yorukot Are you okay with using this library for Windows Delete function, or is there something other thing we should try first ?

If thats okay, I can start with the implementation and testing.

lazysegtree avatar Jan 24 '25 11:01 lazysegtree

@lazysegtree yes i am ok with that

yorukot avatar Jan 25 '25 18:01 yorukot

@wxutopia @Zim-Inn @Hettomei Thanks for the bug report. This has been fixed. Can you do a local build spf from the main branch and see if the issue if fixed for you ?

lazysegtree avatar Feb 06 '25 00:02 lazysegtree

Closing this. Please feel free to reopen if you still face the issue.

lazysegtree avatar Feb 09 '25 08:02 lazysegtree