Closed ash-hashtag closed 1 year ago
SourceDir
is needed to get the relative path of the files. The relative paths of the files are saved to the zip.
For example files:
/a/b/c/file1.txt
/a/b/c/d/file2.txt
If sourceDir
is /a/b
, the relative paths are:
c/file1.txt
c/d/file2.txt
If sourceDir
is /a
, the relative paths are:
b/c/file1.txt
b/c/d/file2.txt
isn't copying files just to a directory, just for zipping them is a waste?
Did you already try with sourceDir="/" ?
Nope, but that should make very long nested files according to the explanation, right?
Yes. It could be useful to allow sourceDir
being null, in which case all listed files would be zipped without path information. Duplicate file names would be a problem though (maybe just overwrite or throw error). PRs also welcome :)
Shouldn't List files would be enough? So I selected some files from different places, So they aren't in a single directory, So should I keep the sourceDir to be the root Directory of the entire phone? I think the best would be to copy all the files to some tempDir and pass it? But still what has it anything to do? List files goes in --> A Zip File should come out, I mean yeah write to a zip file, but why take a sourceDir?