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)
10
10
end
11
11
12
12
import stdlib .fileio .expanduser
13
+ import stdlib .fileio .which
13
14
14
15
archive = expanduser(archive );
15
16
16
17
assert(isfile(archive ), " %s is not a file" , archive )
17
18
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" )
31
21
32
22
tar_arc = tempname ;
33
23
34
- ret = system(" zstd -d " + archive + " -o " + tar_arc );
24
+ ret = system(exe + " -d " + archive + " -o " + tar_arc );
35
25
assert(ret == 0 , " problem extracting %s" , archive )
36
26
37
27
untar(tar_arc , out_dir )
You can’t perform that action at this time.
0 commit comments