Skip to content

Instantly share code, notes, and snippets.

@timo
Created June 23, 2013 14:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save timo/a7f69bb57820a9e5ce88 to your computer and use it in GitHub Desktop.
From 09bdebea39106ad7e69aa6876f4ad801c530e819 Mon Sep 17 00:00:00 2001
From: Timo Paulssen <timonator@perpetuum-immobile.de>
Date: Sun, 23 Jun 2013 16:37:56 +0200
Subject: [PATCH] make sure not to endlessly recurse into the same directory
---
bin/ufo | 1 +
1 file changed, 1 insertion(+)
diff --git a/bin/ufo b/bin/ufo
index d32d777..e216973 100755
--- a/bin/ufo
+++ b/bin/ufo
@@ -185,6 +185,7 @@ sub find-file-by-ext(@dirs, *@ext) {
sub dirwalk(Str $dir = '.', Mu :$d = none(<. ..>), Mu :$f = *, :&dx = -> $ {}, :&fx = -> $ {}) {
for dir($dir, :test(*)) -> $p {
+ when $p ~~ /['/..'$|^$dir$]/ { }
when $p.f {
fx($p.path) if $p.path ~~ $f
}
--
1.8.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment