aboutsummaryrefslogtreecommitdiff
path: root/jim-file.c
diff options
context:
space:
mode:
authorAlexander Shpilkin <ashpilkin@gmail.com>2012-09-17 15:52:47 +0400
committerSteve Bennett <steveb@workware.net.au>2012-09-20 08:47:26 +1000
commit7bf43eb589f738b7bdb3b4837bc0dde304046a2d (patch)
treeb412fd58f67f0fa8473b447698c670e14d629b4f /jim-file.c
parent33e51c4b9ef4de3398a57da99eb6f5fbcd1d85e4 (diff)
downloadjimtcl-7bf43eb589f738b7bdb3b4837bc0dde304046a2d.zip
jimtcl-7bf43eb589f738b7bdb3b4837bc0dde304046a2d.tar.gz
jimtcl-7bf43eb589f738b7bdb3b4837bc0dde304046a2d.tar.bz2
Add support for glob -directory
Implement support for the -directory option to the [glob] command. The -tails option is accepted for Tcl compatibility, but ignored; the command always behaves as if -tails were given.
Diffstat (limited to 'jim-file.c')
-rw-r--r--jim-file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/jim-file.c b/jim-file.c
index 8214437..6b834a2 100644
--- a/jim-file.c
+++ b/jim-file.c
@@ -199,7 +199,9 @@ static int file_cmd_dirname(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
const char *path = Jim_String(argv[0]);
const char *p = strrchr(path, '/');
- if (!p) {
+ if (!p && path[0] == '.' && path[1] == '.' && path[2] == '\0') {
+ Jim_SetResultString(interp, "..", -1);
+ } else if (!p) {
Jim_SetResultString(interp, ".", -1);
}
else if (p == path) {