* @brief Read project and perform comparison specified * @param [in] sProject Full path to project file. * @return `true` if loading project file and starting compare succeeded. */
| 1498 | * @return `true` if loading project file and starting compare succeeded. |
| 1499 | */ |
| 1500 | bool CMergeApp::LoadAndOpenProjectFile(const String& sProject, const String& sReportFile) |
| 1501 | { |
| 1502 | ProjectFile project; |
| 1503 | if (!LoadProjectFile(sProject, project)) |
| 1504 | return false; |
| 1505 | |
| 1506 | bool rtn = true; |
| 1507 | for (auto& projItem : project.Items()) |
| 1508 | { |
| 1509 | std::unique_ptr<PrediffingInfo> pInfoPrediffer; |
| 1510 | std::unique_ptr<PackingInfo> pInfoUnpacker; |
| 1511 | PathContext tFiles; |
| 1512 | bool bDummy = false; |
| 1513 | projItem.GetPaths(tFiles, bDummy); |
| 1514 | for (int i = 0; i < tFiles.GetSize(); ++i) |
| 1515 | { |
| 1516 | tFiles[i] = env::ExpandEnvironmentVariables(tFiles[i]); |
| 1517 | if (!paths::IsPathAbsolute(tFiles[i]) && !paths::IsURL(tFiles[i])) |
| 1518 | { |
| 1519 | String sProjectDir = paths::GetParentPath(sProject); |
| 1520 | if (tFiles[i].substr(0, 1) == _T("\\")) |
| 1521 | { |
| 1522 | if (sProjectDir.length() > 1 && sProjectDir[1] == ':') |
| 1523 | tFiles[i] = paths::ConcatPath(sProjectDir.substr(0, 2), tFiles[i]); |
| 1524 | } |
| 1525 | else |
| 1526 | tFiles[i] = paths::ConcatPath(sProjectDir, tFiles[i]); |
| 1527 | } |
| 1528 | } |
| 1529 | bool bLeftReadOnly = projItem.GetLeftReadOnly(); |
| 1530 | bool bMiddleReadOnly = projItem.GetMiddleReadOnly(); |
| 1531 | bool bRightReadOnly = projItem.GetRightReadOnly(); |
| 1532 | if (Options::Project::Get(GetOptionsMgr(), Options::Project::Operation::Open, Options::Project::Item::FileFilter) && projItem.HasFilter()) |
| 1533 | { |
| 1534 | String filter = projItem.GetFilter(); |
| 1535 | filter = strutils::trim_ws(filter); |
| 1536 | GetGlobalFileFilter()->SetMaskOrExpression(filter); |
| 1537 | } |
| 1538 | bool bRecursive = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS); |
| 1539 | if (Options::Project::Get(GetOptionsMgr(), Options::Project::Operation::Open, Options::Project::Item::IncludeSubfolders) && projItem.HasSubfolders()) |
| 1540 | bRecursive = projItem.GetSubfolders() > 0; |
| 1541 | if (Options::Project::Get(GetOptionsMgr(), Options::Project::Operation::Open, Options::Project::Item::Plugin)) |
| 1542 | { |
| 1543 | if (projItem.HasUnpacker()) |
| 1544 | pInfoUnpacker.reset(new PackingInfo(projItem.GetUnpacker())); |
| 1545 | if (projItem.HasPrediffer()) |
| 1546 | pInfoPrediffer.reset(new PrediffingInfo(projItem.GetPrediffer())); |
| 1547 | } |
| 1548 | int nID = 0; |
| 1549 | if (projItem.HasWindowType()) |
| 1550 | nID = ID_MERGE_COMPARE_TEXT + projItem.GetWindowType() - 1; |
| 1551 | std::unique_ptr<CMainFrame::OpenTableFileParams> pOpenTableFileParams; |
| 1552 | if (nID == ID_MERGE_COMPARE_TABLE) |
| 1553 | { |
| 1554 | pOpenTableFileParams = std::make_unique<CMainFrame::OpenTableFileParams>(); |
| 1555 | pOpenTableFileParams->m_tableDelimiter = projItem.GetTableDelimiter(); |
| 1556 | pOpenTableFileParams->m_tableQuote = projItem.GetTableQuote(); |
| 1557 | pOpenTableFileParams->m_tableAllowNewlinesInQuotes = projItem.GetTableAllowNewLinesInQuotes(); |