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.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
index de3ef49b..919a6813 100644
--- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
+++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
@@ -75,6 +75,16 @@ bool Backend::isDir(QString file){
return contents.value(file)[0].startsWith("d");
}
+bool Backend::isLink(QString file){
+ if(!contents.contains(file)){ return false; }
+ return contents.value(file)[0].startsWith("l");
+}
+
+QString Backend::linkTo(QString file){
+ if(!contents.contains(file)){ return ""; }
+ return contents.value(file)[2];
+}
+
//Modification routines
void Backend::startAdd(QStringList paths){
//NOTE: All the "paths" have to have the same parent directory
@@ -153,14 +163,23 @@ void Backend::parseLines(QStringList lines){
QString file = info[1];
QString perms = "";
if(file.endsWith("/")){ perms = "d"; file.chop(1); }
- contents.insert(file, QStringList() << perms << "-1" ); //Save the [perms, size ]
+ contents.insert(file, QStringList() << perms << "-1" <<""); //Save the [perms, size, linkto ]
}
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];
if(file.endsWith("/")){ file.chop(1); }
- contents.insert(file, QStringList() << info[0] << info[4] ); //Save the [perms, size ]
+ QString linkto;
+ //See if this file has the "link to" or "->" notation
+ if(file.contains(" -> ")){ linkto = file.section(" -> ",1,-1); file = file.section(" -> ",0,0); }
+ else if(file.contains(" link to ")){
+ //Special case - alternate form of a link within a tar archive (not reflected in perms)
+ linkto = file.section(" link to ",1,-1);
+ file = file.section(" link to ",0,0);
+ if(info[0].startsWith("-")){ info[0].replace(0,1,"l"); }
+ }
+ contents.insert(file, QStringList() << info[0] << info[4] << linkto); //Save the [perms, size, linkto ]
}
}
@@ -178,7 +197,7 @@ void Backend::startList(){
void Backend::procFinished(int retcode, QProcess::ExitStatus){
static QString result;
processData();
- qDebug() << "Process Finished:" << PROC.arguments() << retcode;
+ //qDebug() << "Process Finished:" << PROC.arguments() << retcode;
LIST = STARTING = false;
if(PROC.arguments().contains("-tv")){
if(retcode!=0){ contents.clear(); } //could not read archive
bgstack15