fix #672 "added suppor folder for tr option "

This commit is contained in:
Andrei Yankovich 2021-10-26 18:38:23 +03:00
parent bf81c108c7
commit 0dab3b5784
2 changed files with 26 additions and 9 deletions

View File

@ -269,8 +269,22 @@ bool Extracter::copyTr() {
const auto trFiles = i->tr();
for (const auto &tr: trFiles) {
if (!_fileManager->copyFile(tr, cnf->getPackageTargetDir(i.key()) + i->getTrOutDir())) {
return false;
QFileInfo info(tr);
if (info.isDir()) {
QDir dir(info.absoluteFilePath());
auto availableQm = dir.entryInfoList({"*.qm"}, QDir::Files);
for (const auto & trFile : qAsConst(availableQm)) {
if (!_fileManager->copyFile(trFile.absoluteFilePath(),
cnf->getPackageTargetDir(i.key()) + i->getTrOutDir())) {
return false;
}
}
} else {
if (!_fileManager->copyFile(tr, cnf->getPackageTargetDir(i.key()) + i->getTrOutDir())) {
return false;
}
}
}
}

View File

@ -1190,21 +1190,24 @@ void deploytest::testDeployGeneralFiles() {
void deploytest::testTr() {
TestUtils utils;
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "QtWidgetsProject";
QString qmake = TestQtDir + "bin/qmake";
QString bin = TestBinDir + "TestOnlyC";
#else
QString bin = TestBinDir + "QtWidgetsProject.exe";
QString qmake = TestQtDir + "bin/qmake.exe";
QString bin = TestBinDir + "TestOnlyC.exe";
#endif
auto comapareTree = TestModule.qtLibs();
auto comapareTree = TestModule.onlyC();
comapareTree += utils.createTree({"./" + DISTRO_DIR + "/translations/TestTr.qm"});
runTestParams({"-bin", bin, "clear" ,
"-tr", ":/testResurces/testRes/TestTr.qm",
"-qmake", qmake}, &comapareTree);
"-tr", ":/testResurces/testRes/TestTr.qm",}, &comapareTree,
true);
runTestParams({"-bin", bin, "clear" ,
"-tr", ":/testResurces/testRes/"},
&comapareTree, true);
}
void deploytest::testVirtualKeyBoard() {