Skip to content

Add windows wildcard support#75

Merged
babarot merged 1 commit intomainfrom
babarot/windows-wildcard-2
Feb 17, 2025
Merged

Add windows wildcard support#75
babarot merged 1 commit intomainfrom
babarot/windows-wildcard-2

Conversation

@babarot
Copy link
Copy Markdown
Owner

@babarot babarot commented Feb 17, 2025

WHAT

Add Windows wildcard support and home fallback feature

  • Add glob pattern expansion for Windows file paths
  • Enable home fallback option when external trash fails
  • Fix directory path validation to better handle Windows paths

WHY

fix #63

@babarot
Copy link
Copy Markdown
Owner Author

babarot commented Feb 17, 2025

test is done, here: https://github.com/babarot/sandbox/actions/runs/13373695890/job/37350038240

test log
Test directory contents:
    Directory: D:\a\sandbox\sandbox\testfiles
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           2/17/2025  4:07 PM       [19](https://github.com/babarot/sandbox/actions/runs/13373695890/job/37350038240#step:5:20)569664 app.exe
-a---           2/17/[20](https://github.com/babarot/sandbox/actions/runs/13373695890/job/37350038240#step:5:21)25  4:07 PM              6 file1.log
-a---           2/17/2025  4:07 PM              6 file2.log
-a---           2/17/2025  4:07 PM              6 file3.log
-a---           2/17/20[25](https://github.com/babarot/sandbox/actions/runs/13373695890/job/37350038240#step:5:26)  4:07 PM              6 log.dat
-a---           2/17/2025  4:07 PM              6 log1.data
-a---           2/17/2025  4:07 PM              6 log2.data
-a---           2/17/2025  4:07 PM              6 log3.data
-a---           2/17/2025  4:07 PM              6 testa.txt
-a---           2/17/2025  4:07 PM              6 testb.txt
-a---           2/17/2025  4:07 PM              6 testc.txt


Current working directory:
Testing with pattern: *.txt
4:07PM DEBUG <cli/cli.go:99> main function started version=unset revision=unset buildDate=unknown
4:07PM DEBUG <config/config.go:176> config path found config-path=C:\Users\runneradmin\.config\gomi\config.yaml
4:07PM DEBUG <config/config.go:259> ensure config
4:07PM DEBUG <config/config.go:229> config unmarshaled into struct
4:07PM DEBUG <config/config.go:292> config validate done
4:07PM DEBUG <config/config.go:199> config successfully loaded
4:07PM INFO  <xdg/storage.go:48>  initialize xdg storage 
4:07PM WARN  <xdg/mountpoint_windows.go:41> could not get filesystem type drive=A:\ error="GetVolumeInformation failed: The device is not ready."
4:07PM DEBUG <xdg/mountpoint_windows.go:76> found mount point mountpoint=C:\ fstype=NTFS volumeName=Windows
4:07PM DEBUG <xdg/mountpoint_windows.go:76> found mount point mountpoint=D:\ fstype=NTFS volumeName="Temporary Storage"
4:07PM DEBUG <xdg/mountpoint_windows.go:228> no trash directory path=C:\.Trash\-1
4:07PM DEBUG <xdg/mountpoint_windows.go:228> no trash directory path=C:\.Trash--1
4:07PM DEBUG <xdg/mountpoint_windows.go:228> no trash directory path=D:\.Trash\-1
4:07PM DEBUG <xdg/mountpoint_windows.go:228> no trash directory path=D:\.Trash--1
4:07PM DEBUG <trash/manager.go:75> determine strategy based on current storages
4:07PM INFO  <trash/manager.go:78>  trash manager  strategy=xdg
4:07PM DEBUG <cli/put.go:40> cli.put started
4:07PM DEBUG <cli/put.go:221> path safety check original=testc.txt originalBase=testc.txt cleaned=testc.txt
4:07PM DEBUG <cli/put.go:221> path safety check original=testb.txt originalBase=testb.txt cleaned=testb.txt
4:07PM DEBUG <cli/put.go:221> path safety check original=testa.txt originalBase=testa.txt cleaned=testa.txt
4:07PM DEBUG <trash/manager.go:108> putting file to trash source=D:\a\sandbox\sandbox\testfiles\testc.txt absolute_path=D:\a\sandbox\sandbox\testfiles\testc.txt strategy=xdg storages=1
4:07PM DEBUG <trash/manager.go:108> putting file to trash source=D:\a\sandbox\sandbox\testfiles\testb.txt absolute_path=D:\a\sandbox\sandbox\testfiles\testb.txt strategy=xdg storages=1
4:07PM DEBUG <trash/manager.go:108> putting file to trash source=D:\a\sandbox\sandbox\testfiles\testa.txt absolute_path=D:\a\sandbox\sandbox\testfiles\testa.txt strategy=xdg storages=1
4:07PM DEBUG <xdg/mountpoint_windows.go:153> resolved symlink from=D:\a\sandbox\sandbox\testfiles\testc.txt to=D:\a\sandbox\sandbox\testfiles\testc.txt
4:07PM DEBUG <xdg/mountpoint_windows.go:153> resolved symlink from=D:\a\sandbox\sandbox\testfiles\testb.txt to=D:\a\sandbox\sandbox\testfiles\testb.txt
4:07PM DEBUG <xdg/mountpoint_windows.go:153> resolved symlink from=D:\a\sandbox\sandbox\testfiles\testa.txt to=D:\a\sandbox\sandbox\testfiles\testa.txt
4:07PM DEBUG <xdg/mountpoint_windows.go:159> resolved symlink from=C:\Users\runneradmin\.local\share\Trash to=C:\Users\runneradmin\.local\share\Trash
4:07PM DEBUG <xdg/mountpoint_windows.go:159> resolved symlink from=C:\Users\runneradmin\.local\share\Trash to=C:\Users\runneradmin\.local\share\Trash
4:07PM DEBUG <xdg/mountpoint_windows.go:159> resolved symlink from=C:\Users\runneradmin\.local\share\Trash to=C:\Users\runneradmin\.local\share\Trash
4:07PM DEBUG <xdg/mountpoint_windows.go:176> device comparison path1=D:\a\sandbox\sandbox\testfiles\testb.txt drive1=D: volumeInfo1="Temporary Storage_650358900" path2=C:\Users\runneradmin\.local\share\Trash drive2=C: volumeInfo2=Windows_485[34](https://github.com/babarot/sandbox/actions/runs/13373695890/job/37350038240#step:6:35)6824
4:07PM DEBUG <xdg/mountpoint_windows.go:181> device comparison result sameDevice=false
4:07PM DEBUG <xdg/mountpoint_windows.go:176> device comparison path1=D:\a\sandbox\sandbox\testfiles\testc.txt drive1=D: volumeInfo1="Temporary Storage_650[35](https://github.com/babarot/sandbox/actions/runs/13373695890/job/37350038240#step:6:36)8900" path2=C:\Users\runneradmin\.local\share\Trash drive2=C: volumeInfo2=Windows_485346824
4:07PM DEBUG <xdg/mountpoint_windows.go:181> device comparison result sameDevice=false
4:07PM DEBUG <xdg/mountpoint_windows.go:176> device comparison path1=D:\a\sandbox\sandbox\testfiles\testa.txt drive1=D: volumeInfo1="Temporary Storage_650358900" path2=C:\Users\runneradmin\.local\share\Trash drive2=C: volumeInfo2=Windows_485346824
4:07PM DEBUG <xdg/mountpoint_windows.go:181> device comparison result sameDevice=false
4:07PM DEBUG <trash/manager.go:126> moved file to trash path=D:\a\sandbox\sandbox\testfiles\testb.txt
4:07PM DEBUG <trash/manager.go:126> moved file to trash path=D:\a\sandbox\sandbox\testfiles\testc.txt
4:07PM DEBUG <trash/manager.go:126> moved file to trash path=D:\a\sandbox\sandbox\testfiles\testa.txt
4:07PM DEBUG <cli/put.go:69> cli.put finished
4:07PM DEBUG <cli/cli.go:161> main function finished


Directory contents after *.txt:
Path
----
D:\a\sandbox\sandbox\testfiles
LastWriteTime : 2/17/2025 4:07:57 PM
Length        : 19569664
Name          : app.exe
LastWriteTime : 2/17/2025 4:07:58 PM
Length        : 6
Name          : file1.log
LastWriteTime : 2/17/2025 4:07:58 PM
Length        : 6
Name          : file2.log
LastWriteTime : 2/17/2025 4:07:58 PM
Length        : 6
Name          : file3.log
LastWriteTime : 2/17/2025 4:07:58 PM
Length        : 6
Name          : log.dat
LastWriteTime : 2/17/2025 4:07:58 PM
Length        : 6
Name          : log1.data
LastWriteTime : 2/17/2025 4:07:58 PM
Length        : 6
Name          : log2.data
LastWriteTime : 2/17/2025 4:07:58 PM
Length        : 6
Name          : log3.data

@babarot babarot merged commit 3dffa66 into main Feb 17, 2025
5 checks passed
@babarot babarot deleted the babarot/windows-wildcard-2 branch February 17, 2025 16:15
@github-actions github-actions bot mentioned this pull request Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gomi *

1 participant