add:在经典工程文件中resouce文件夹将会覆盖安装目录的resouce

This commit is contained in:
shijianquan 2025-10-14 09:52:04 +08:00
parent 82e405212a
commit d2faf5ba51
2 changed files with 22 additions and 3 deletions

View File

@ -1015,6 +1015,21 @@ bool db_manager_api::initCompleteProjectExe()
srcList.append(strProductSrcPath);
}
// 处理resource文件夹当经典工程的文件夹下有resource文件时覆盖至程序安装目录的resource文件夹
QString strResourceDstPath = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../resource" ).c_str();
QString strResourceSrcPath = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../products/").c_str();
strResourceSrcPath += QDir::separator()+m_productName + QDir::separator() + m_projectName + QDir::separator()+ "resource";
if (dbDir.exists(strResourceSrcPath))
{
dstList.append(strResourceDstPath);
srcList.append(strResourceSrcPath);
sig_showMsg(tr("复制文件resource..."));
}
else
{
sig_showMsg(tr("不复制文件resource..."));
}
m_pFileOpt->deleteDir(strDataDstPath);
if (!m_pFileOpt->copyFiles(srcList, dstList))
{

View File

@ -123,10 +123,14 @@ bool file_opt::copyDirectoryFiles(const QString& fromDir, const QString& toDir,
continue;
}
/**< 当允许覆盖操作时,将旧文件进行删除操作 */
if ( coverFileIfExist && targetDir.exists( fileInfo.fileName() ) )
/**< 当允许覆盖操作时,处理目标文件 */
if ( coverFileIfExist )
{
targetDir.remove( fileInfo.fileName() );
// 如果目标文件存在,先删除它
if ( targetDir.exists( fileInfo.fileName() ) )
{
targetDir.remove( fileInfo.fileName() );
}
}
/// 进行文件copy