aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
index 60ae9ce1..c0d3b03e 100644
--- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
+++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
@@ -105,8 +105,8 @@ void Backend::startAdd(QStringList paths){
args << paths;
if(QFile::exists(filepath)){ //append to existing
args.replaceInStrings(filepath, tmpfilepath);
- args<< "@"+filepath;
- }
+ args<< "@"+filepath;
+ }
STARTING=true;
PROC.start("tar", args);
}
@@ -117,12 +117,12 @@ void Backend::startRemove(QStringList paths){
QStringList args;
args << "-c" << "-a";
args << flags;
- args.replaceInStrings(filepath, tmpfilepath);
+ args.replaceInStrings(filepath, tmpfilepath);
//Add the include rules for all the files we want to keep (no exclude option in "tar")
for(int i=0; i<paths.length(); i++){
args << "--exclude" << paths[i];
}
- args<< "@"+filepath;
+ args<< "@"+filepath;
STARTING=true;
PROC.start("tar", args);
}
@@ -172,7 +172,7 @@ void Backend::parseLines(QStringList lines){
if(info.startsWith("x ") && filepath.endsWith(".zip")){
//ZIP archives do not have all the extra information - just filenames
while(info.length()>2){ info[1]=info[1]+" "+info[2]; }
- QString file = info[1];
+ QString file = info[1];
QString perms = "";
if(file.endsWith("/")){ perms = "d"; file.chop(1); }
contents.insert(file, QStringList() << perms << "-1" <<""); //Save the [perms, size, linkto ]
@@ -180,7 +180,7 @@ void Backend::parseLines(QStringList lines){
else if(info.length()<9){ continue; } //invalid line
//TAR Archive parsing
while(info.length()>9){ info[8] = info[8]+" "+info[9]; info.removeAt(9); } //Filename has spaces in it
- QString file = info[8];
+ QString file = info[8];
if(file.endsWith("/")){ file.chop(1); }
QString linkto;
//See if this file has the "link to" or "->" notation
@@ -234,9 +234,14 @@ void Backend::procFinished(int retcode, QProcess::ExitStatus){
QProcess::startDetached("xdg-open \""+path+"\"");
}else{
//Multi-file extract - open the dir instead
- QProcess::startDetached("xdg-open \""+ args.last()+"\""); //just extracted to a dir - open it now
+ QString dir = args.last();
+ //Check to see if tar extracted into a new subdir it just created
+ if(QFile::exists(dir+"/"+filepath.section("/",-1).section(".",0,0) ) ){
+ dir = dir+"/"+filepath.section("/",-1).section(".",0,0);
+ }
+ QProcess::startDetached("xdg-open \""+ dir+"\""); //just extracted to a dir - open it now
}
-
+
}else if(args.contains("-c") && QFile::exists(tmpfilepath)){
if(retcode==0){
QFile::remove(filepath);
@@ -253,7 +258,7 @@ void Backend::procFinished(int retcode, QProcess::ExitStatus){
}
void Backend::processData(){
- //Read the process
+ //Read the process
static QString data;
QString read = data+PROC.readAllStandardOutput();
if(read.endsWith("\n")){ data.clear(); }
bgstack15