Like the create_option
: cwd
in the zip.create/3
: http://erlang.org/doc/man/zip.html#create-3
Unfortunately, erl_tar:create
does not have this option. Am I able to change cwd when calling erl_tar:create?
According to cwd option doc what it's doing is just to prepend filenames with directory, you can do the same in erl_tar:create
, e.g. by changing the filename from 'test.tar'
to '../test.tar'
Uses the specified directory as current work directory (cwd). This is prepended to filenames when adding them, although not in the zip archive (acting like file:set_cwd/1 in Kernel, but without changing the global cwd property.).
changing cwd sounds dangerous since it may result in runtime errors if you are using some other files in your current cwd (or relative to your current cwd).