New FileUtil::makeRelativeIfInDir func; label parser_3 barcode map; unit tests
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user