Raise exception on adding a non-existent file to a zip archive
This commit is contained in:
parent
1da251523f
commit
fa3545c092
1 changed files with 5 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue