New FileUtil::makeRelativeIfInDir func; label parser_3 barcode map; unit tests

This commit is contained in:
gitlost
2019-08-26 03:00:32 +01:00
parent e8daa8aa48
commit 7e44bbdc06
37 changed files with 2613 additions and 55 deletions
+12
View File
@@ -108,5 +108,17 @@ namespace glabels
return QDir("/");
}
QString FileUtil::makeRelativeIfInDir( const QDir& dir,
const QString& filename )
{
QString relativeFilePath = dir.relativeFilePath( filename ); // Note: directory separators canonicalized to slash by Qt path methods
if ( !relativeFilePath.startsWith( "../" ) )
{
return relativeFilePath;
}
return filename;
}
}
}