summaryrefslogtreecommitdiff
path: root/util.myr
diff options
context:
space:
mode:
Diffstat (limited to 'util.myr')
-rw-r--r--util.myr17
1 files changed, 12 insertions, 5 deletions
diff --git a/util.myr b/util.myr
index 463c2c9..57872b1 100644
--- a/util.myr
+++ b/util.myr
@@ -106,11 +106,18 @@ const gettarg = {tab, n
const setdir = {b, dir
var p
- p = std.pathcat(b.basedir, dir)
- std.put("changing into '%s'\n", p)
- if !std.chdir(p)
- std.fatal(1, "could not cd into %s\n")
+ if !std.sleq(b.curdir, dir)
+ p = std.pathcat(b.basedir, dir)
+ if b.curdir.len != 0
+ std.put("Leaving directory %s\n", b.curdir)
+ ;;
+
+ std.put("Entering directory '%s'\n", dir)
+ if !std.chdir(p)
+ std.fatal(1, "could not cd into %s\n")
+ ;;
+ b.curdir = dir
+ std.slfree(p)
;;
- std.slfree(p)
}