@@ -1465,44 +1465,55 @@ bool CResource::ReadIncludedHTML(CXMLNode* pRoot)
1465
1465
1466
1466
if (!strFilename.empty ())
1467
1467
{
1468
- std::string strFullFilename;
1469
1468
ReplaceSlashes (strFilename);
1470
1469
1471
- if (IsFilenameUsed (strFilename, false ))
1470
+ if (! IsValidFilePath (strFilename. c_str () ))
1472
1471
{
1473
- CLogger::LogPrintf (" WARNING: Duplicate html file in resource '%s': '%s'\n " , m_strResourceName.c_str (), strFilename.c_str ());
1472
+ m_strFailureReason = SString (" Couldn't find html %s for resource %s\n " , strFilename.c_str (), m_strResourceName.c_str ());
1473
+ CLogger::ErrorPrintf (m_strFailureReason);
1474
+ return false ;
1474
1475
}
1475
1476
1476
- // Try to find the file
1477
- if (IsValidFilePath (strFilename. c_str ()) && GetFilePath (strFilename. c_str (), strFullFilename ))
1477
+ std::vector<std::string> vecFiles = GetFilePaths (strFilename. c_str ());
1478
+ if (vecFiles. empty ( ))
1478
1479
{
1479
- // This one is supposed to be default, but there's already a default page
1480
- if (bFoundDefault && bIsDefault)
1480
+ if (glob::has_magic (strFilename))
1481
1481
{
1482
- CLogger::LogPrintf (" Only one html item can be default per resource, ignoring %s in %s\n " , strFilename.c_str (),
1483
- m_strResourceName.c_str ());
1484
- bIsDefault = false ;
1482
+ m_ResourceFilesCountPerDir[strFilename] = vecFiles.size ();
1483
+ continue ;
1485
1484
}
1486
1485
1487
- // If this is supposed to be default, we've now found our default page
1488
- if (bIsDefault)
1489
- bFoundDefault = true ;
1490
-
1491
- // Create a new resource HTML file and add it to the list
1492
- auto pResourceFile = new CResourceHTMLItem (this , strFilename.c_str (), strFullFilename.c_str (), &Attributes, bIsDefault, bIsRaw,
1493
- bIsRestricted, m_bOOPEnabledInMetaXml);
1494
- m_ResourceFiles.push_back (pResourceFile);
1495
-
1496
- // This is the first HTML file? Remember it
1497
- if (!pFirstHTML)
1498
- pFirstHTML = pResourceFile;
1499
- }
1500
- else
1501
- {
1502
1486
m_strFailureReason = SString (" Couldn't find html %s for resource %s\n " , strFilename.c_str (), m_strResourceName.c_str ());
1503
1487
CLogger::ErrorPrintf (m_strFailureReason);
1504
1488
return false ;
1505
1489
}
1490
+
1491
+ for (const std::string& strFilePath : vecFiles)
1492
+ {
1493
+ std::string strFullFilename;
1494
+
1495
+ if (GetFilePath (strFilePath.c_str (), strFullFilename))
1496
+ {
1497
+ // This one is supposed to be default, but there's already a default page
1498
+ if (bFoundDefault && bIsDefault)
1499
+ {
1500
+ CLogger::LogPrintf (" Only one html item can be default per resource, ignoring %s in %s\n " , strFilename.c_str (), m_strResourceName.c_str ());
1501
+ bIsDefault = false ;
1502
+ }
1503
+
1504
+ // If this is supposed to be default, we've now found our default page
1505
+ if (bIsDefault)
1506
+ bFoundDefault = true ;
1507
+
1508
+ // Create a new resource HTML file and add it to the list
1509
+ auto pResourceFile = new CResourceHTMLItem (this , strFilename.c_str (), strFullFilename.c_str (), &Attributes, bIsDefault, bIsRaw, bIsRestricted, m_bOOPEnabledInMetaXml);
1510
+ m_ResourceFiles.push_back (pResourceFile);
1511
+
1512
+ // This is the first HTML file? Remember it
1513
+ if (!pFirstHTML)
1514
+ pFirstHTML = pResourceFile;
1515
+ }
1516
+ }
1506
1517
}
1507
1518
else
1508
1519
{
0 commit comments