Browse Source

fix windows file glob matching for d/,./ etc

master
Julian Noble 1 year ago
parent
commit
dea3ca01db
  1. 1
      src/modules/punk-0.1.tm
  2. 11
      src/modules/punk/du-999999.0a1.0.tm

1
src/modules/punk-0.1.tm

@ -5857,6 +5857,7 @@ namespace eval punk {
set chunklist [list]
}
#only merge results if location matches previous (caller can deliberately intersperse bogus globs to force split if desired)
#TODO - remove duplicate file or dir items for overlapping patterns in same location!!! (at least for count, filebyte totals if not for display)
set last_location ""
set this_result [dict create]
foreach searchspec $args {

11
src/modules/punk/du-999999.0a1.0.tm

@ -552,6 +552,11 @@ namespace eval punk::du {
set errors [dict create]
set altname "" ;#possible we have to use a different name e.g short windows name or dos-device path //?/
# return it so it can be stored and tried as an alternative for problem paths
#puts stderr ">>> glob: $opt_glob"
#REVIEW! windows api pattern matchttps://www.red-gate.com/simple-talk/blogs/the-unexpected-behaviour-of-directoryinfo-getfiles-with-three-letter-extensions/hing is .. weird. partly due to 8.3 filenames
#https://www.red-gate.com/simple-talk/blogs/the-unexpected-behaviour-of-directoryinfo-getfiles-with-three-letter-extensions/
#we will certainly need to check the resulting listing with our supplied glob.. but maybe we will have to change the glob passed to find_file_open too.
# using * all the time may be inefficient - so we might be able to avoid that in some cases.
try {
#glob of * will return dotfiles too on windows
set iterator [twapi::find_file_open [file join $folderpath $opt_glob] -detail basic] ;# -detail full only adds data to the altname field
@ -682,6 +687,11 @@ namespace eval punk::du {
while {[twapi::find_file_next $iterator iteminfo]} {
set nm [dict get $iteminfo name]
#recheck glob
#review!
if {![string match $opt_glob $nm]} {
continue
}
set tail_altname [dict get $iteminfo altname] ;#altname of tail - not whole path
set attrinfo [decode_win_attributes [dict get $iteminfo attrs]]
#puts stderr "$iteminfo"
@ -689,6 +699,7 @@ namespace eval punk::du {
set ftype ""
#attributes applicable to any classification
set fullname [file_join_one $folderpath $nm]
if {"hidden" in $attrinfo} {
lappend flaggedhidden $fullname
}

Loading…
Cancel
Save