summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMantas Mikulėnas <grawity@gmail.com>2018-06-26 14:58:08 +0300
committerMantas Mikulėnas <grawity@gmail.com>2018-06-26 14:58:08 +0300
commit82c95c133d06acb19c1e82a0f76c541920f91409 (patch)
tree70193219fe5fdb2394d017312992c55aace5be3c
parentcdbebb797029778f6aa6dfa495d99f5fd5251034 (diff)
collapse '/' initial path item when fake-root is givenarch
Before, "/foo/bar/baz" would result in: ["fakeroot", "/", "foo", "bar", baz"] fakeroot///foo/bar/baz After: ["fakeroot", "foo", "bar", baz"] fakeroot/foo/bar/baz
-rwxr-xr-xtreeify3
1 files changed, 3 insertions, 0 deletions
diff --git a/treeify b/treeify
index fe892af..24356b9 100755
--- a/treeify
+++ b/treeify
@@ -216,6 +216,9 @@ if ($opt{path}) {
}
if ($opt{fakeroot}) {
+ while ($tree->{"/"}) {
+ $tree = $tree->{"/"}
+ }
$tree = {$opt{fakeroot} => $tree};
}