summary refs log tree commit diff stats
path: root/lib/os.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2008-12-12 14:02:27 +0100
committerAndreas Rumpf <rumpf_a@web.de>2008-12-12 14:02:27 +0100
commitddaedab835fa7ea3457f21a772d636921defdc46 (patch)
tree8f96b5a3a6700704e0a64bdcdedee1d2caf68517 /lib/os.nim
parent2cd136cf7a0210e3cfde7a6f8ba32c9f09560047 (diff)
downloadNim-ddaedab835fa7ea3457f21a772d636921defdc46.tar.gz
version 0.7.2
Diffstat (limited to 'lib/os.nim')
-rw-r--r--lib/os.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/os.nim b/lib/os.nim
index 8ec781000..fa53fa3e2 100644
--- a/lib/os.nim
+++ b/lib/os.nim
@@ -1062,14 +1062,14 @@ proc cmpPaths(pathA, pathB: string): int =
     result = cmpIgnoreCase(pathA, pathB)
 
 proc extractDir(path: string): string =
-  if path[path.len-1] in {dirSep, altSep}:
+  if path.len == 0 or path[path.len-1] in {dirSep, altSep}:
     result = path
   else:
     var tail: string
     splitPath(path, result, tail)
 
 proc extractFilename(path: string): string =
-  if path[path.len-1] in {dirSep, altSep}:
+  if path.len == 0 or path[path.len-1] in {dirSep, altSep}:
     result = ""
   else:
     var head: string