From 05b977fb3d3e4b21acc4500d9db9928034681260 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Sun, 5 Jul 2026 14:03:48 +1000 Subject: [PATCH] punk::path 0.2.1: filter '.' and '..' by tail in treefilenames hidden-dir glob to fix non-Windows recursion loop --- src/modules/punk/path-999999.0a1.0.tm | 3 ++- src/modules/punk/path-buildversion.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/punk/path-999999.0a1.0.tm b/src/modules/punk/path-999999.0a1.0.tm index c57349b7..67ea41c3 100644 --- a/src/modules/punk/path-999999.0a1.0.tm +++ b/src/modules/punk/path-999999.0a1.0.tm @@ -1255,7 +1255,8 @@ namespace eval punk::path { #also match hidden directories if {![catch {glob -nocomplain -dir $opt_dir -types {hidden d} *} hidden_dirdirs]} { foreach h $hidden_dirdirs { - switch -- $h { + #glob -dir returns full paths; compare the tail so '.' and '..' are filtered on all platforms + switch -- [file tail $h] { "." - ".." {continue} default { if {$h ni $dirdirs} { diff --git a/src/modules/punk/path-buildversion.txt b/src/modules/punk/path-buildversion.txt index a0269086..f3c73491 100644 --- a/src/modules/punk/path-buildversion.txt +++ b/src/modules/punk/path-buildversion.txt @@ -1,5 +1,6 @@ -0.2.0 +0.2.1 #First line must be a semantic version number #all other lines are ignored. +#0.2.1 - treefilenames: filter '.' and '..' by tail in the hidden-directory glob so recursion does not loop on non-Windows platforms #0.2.0 - treefilenames now matches hidden files and recurses into hidden directories on all platforms #0.2.0 - added PUNKARGS documentation for punk::path::relative