File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -10,28 +10,18 @@ function extract_zstd(archive, out_dir)
1010end
1111
1212import stdlib .fileio .expanduser
13+ import stdlib .fileio .which
1314
1415archive = expanduser(archive );
1516
1617assert(isfile(archive ), " %s is not a file" , archive )
1718
18- [ret , ~ ] = system(" zstd -h" );
19- if ret ~= 0
20- if ismac
21- msg = " brew install zstd" ;
22- elseif isunix
23- msg = " apt install zstd" ;
24- elseif ispc
25- msg = " https://github.com/facebook/zstd/releases and look for zstd-*-win64.zip" ;
26- else
27- msg = " https://github.com/facebook/zstd/releases" ;
28- end
29- error(" stdlib:fileio:extract_zstd:EnvironmentError" , " need to have Zstd installed: \n install zstd: \n %s" , msg )
30- end
19+ exe = which(" zstd" );
20+ assert(~isempty(exe ), " need to have Zstd installed: https://github.com/facebook/zstd" )
3121
3222tar_arc = tempname ;
3323
34- ret = system(" zstd -d " + archive + " -o " + tar_arc );
24+ ret = system(exe + " -d " + archive + " -o " + tar_arc );
3525assert(ret == 0 , " problem extracting %s" , archive )
3626
3727untar(tar_arc , out_dir )
You can’t perform that action at this time.
0 commit comments