summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2014-10-12 13:49:12 +0200
committerAndreas Rumpf <rumpf_a@web.de>2014-10-12 13:49:12 +0200
commitcb7c485f92ee1f761de4ad183a176cb8809dd9bb (patch)
tree29700d5e46cb044b8fc7fbf4ba184cfac0253ea8
parent399c985b62b35e7d81149ceef5d9a51fdeac35ed (diff)
parentd526e051c516ced3533f421637ca2ea3c11e03db (diff)
downloadNim-cb7c485f92ee1f761de4ad183a176cb8809dd9bb.tar.gz
Merge pull request #1564 from trustable-code/devel
Raise exception on adding a non-existent file to a zip archive
-rw-r--r--lib/impure/zipfiles.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim
index 1726449d8..b9f89dda0 100644
--- a/lib/impure/zipfiles.nim
+++ b/lib/impure/zipfiles.nim
@@ -56,6 +56,8 @@ proc addFile*(z: var TZipArchive, dest, src: string) =
   ## Adds the file `src` to the archive `z` with the name `dest`. `dest`
   ## may contain a path that will be created. 
   assert(z.mode != fmRead) 
+  if not fileExists(src):
+    raise newException(EIO, "File '" & src & "' does not exist")
   var zipsrc = zip_source_file(z.w, src, 0, -1)
   if zipsrc == nil:
     #echo("Dest: " & dest)