diff options
author | Simon Krauter <krauter.simon@arcor.de> | 2014-10-10 23:24:28 +0200 |
---|---|---|
committer | Simon Krauter <krauter.simon@arcor.de> | 2014-10-10 23:24:28 +0200 |
commit | fa3545c092522a43517669387ad2a953a4a2fd04 (patch) | |
tree | 56e00e2e050a453ee4d4436178926406c122e4f4 | |
parent | 1da251523fb5e09d1edcd1ff37c2c993ec26273b (diff) | |
download | Nim-fa3545c092522a43517669387ad2a953a4a2fd04.tar.gz |
Raise exception on adding a non-existent file to a zip archive
-rw-r--r-- | lib/impure/zipfiles.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim index 1726449d8..63b8a843d 100644 --- a/lib/impure/zipfiles.nim +++ b/lib/impure/zipfiles.nim @@ -56,6 +56,11 @@ 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): + var e: ref EIO + new(e) + e.msg = "File does not exist" + raise e var zipsrc = zip_source_file(z.w, src, 0, -1) if zipsrc == nil: #echo("Dest: " & dest) |