mirror of
https://github.com/roswell/roswell.git
synced 2026-09-10 07:16:17 -04:00
support cab extract on windows.
This commit is contained in:
parent
870041371f
commit
1ea7273ab9
|
|
@ -25,17 +25,17 @@ int extract(const char *filename, int do_extract, int flags,const char* outputpa
|
|||
char* type="gzip"; /*for gz*/
|
||||
if(len>4) {
|
||||
int i,c;
|
||||
for(c=0,i=len;filename[i]!='.' && c<5;--i,++c) {
|
||||
if(filename[i]=='b'||filename[i]=='B') {
|
||||
type="bzip2";
|
||||
break;
|
||||
}else if(filename[i]=='x'||filename[i]=='X') {
|
||||
type="xz";
|
||||
break;
|
||||
}else if(filename[i]=='7') {
|
||||
type="7za";
|
||||
break;
|
||||
}
|
||||
const char* ext;
|
||||
for(c=0,i=len;filename[i]!='.' && len>c;--i,++c);
|
||||
ext=filename+i;
|
||||
if(strcmp(".tbz2",ext)==0 || strcmp(".bz2",ext)==0) {
|
||||
type="bzip2";
|
||||
}else if(strcmp(".xz",ext)==0) {
|
||||
type="xz";
|
||||
}else if(strcmp(".7z",ext)==0) {
|
||||
type="7za";
|
||||
}else if(strcmp(".cab",ext)==0) {
|
||||
type="cab";
|
||||
}
|
||||
}
|
||||
cond_printf(1,"extracttype=%s\n",type);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ char* extract_command_str(int flags,const char *filename,int do_extract,const ch
|
|||
}else if(strcmp(type,"7za")==0) {
|
||||
ensure_directories_exist(outputpath2);
|
||||
str=cat(exe," ",do_extract?"x":"t"," -y -o",outputpath2," ",filename2,NULL);
|
||||
}else if(strcmp(type,"cab")==0) {
|
||||
if(do_extract)
|
||||
str=cat("expand.exe /r \"-F:*\" ",filename2," ",outputpath2,NULL);
|
||||
}
|
||||
s(outputpath2),s(filename2),s(_confdir),s(_uname),s(_uname_m);
|
||||
return str;
|
||||
|
|
|
|||
Loading…
Reference in a new issue