Given a directory that has been converted into a tar archive, say "archive.tar", it is often typical to extract this into a directory simply named "archive". The obvious way to achieve this programmatically, for example, when you want to extract a list of tar archives input_files, is to set the list of output directory names as output_list = map(x->split(x,".tar")[1], input_files). However, split returns output with types SubString{String}. While Tar.extract accepts dir::AbstractString, I receive a downstream error from Tar.extract_tarball which requires the output root directory to be a String, with signature extract_tarball(predicate::Function, tar::IO, root::String; kws...).
This can be solved if the user converts the SubString to a standard String before passing to Tar.extract. This is not terribly inconvenient, but I hit this snag in my first attempt to use this package and it confused me for a few minutes. Is there a technical reason why the type of root cannot be any AbstractString in Tar.extract_tarball? Or perhaps Tar.extract should convert dir to a standard String before passing it to Tar.extract_tarball?
Given a directory that has been converted into a tar archive, say "archive.tar", it is often typical to extract this into a directory simply named "archive". The obvious way to achieve this programmatically, for example, when you want to extract a list of tar archives
input_files
, is to set the list of output directory names asoutput_list = map(x->split(x,".tar")[1], input_files)
. However,split
returns output with typesSubString{String}
. WhileTar.extract
acceptsdir::AbstractString
, I receive a downstream error fromTar.extract_tarball
which requires the outputroot
directory to be aString
, with signatureextract_tarball(predicate::Function, tar::IO, root::String; kws...)
.This can be solved if the user converts the
SubString
to a standardString
before passing toTar.extract
. This is not terribly inconvenient, but I hit this snag in my first attempt to use this package and it confused me for a few minutes. Is there a technical reason why the type ofroot
cannot be anyAbstractString
inTar.extract_tarball
? Or perhapsTar.extract
should convertdir
to a standardString
before passing it toTar.extract_tarball?
Running Julia 1.10.3 with Tar 1.10.0.