From 6f19e210b32dc8161d127d9462354db5e7657ad8 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 12 Nov 2007 01:56:40 -0500 Subject: [PATCH] Fix parent-directory on / --- core/io/files/files.factor | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/io/files/files.factor b/core/io/files/files.factor index efa9096791..2bbcab8f93 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -66,12 +66,14 @@ TUPLE: no-parent-directory path ; : parent-directory ( path -- parent ) trim-path-separators - dup root-directory? [ ] [ - dup last-path-separator drop [ - 1+ cut - special-directory? - [ no-parent-directory ] when - ] when* + dup empty? [ drop "/" ] [ + dup root-directory? [ ] [ + dup last-path-separator drop [ + 1+ cut + special-directory? + [ no-parent-directory ] when + ] when* + ] if ] if ; : file-name ( path -- string )