调整更新升级当前目录和拷贝临时文件路径

This commit is contained in:
yangjiaxuan 2022-09-26 11:03:07 +08:00
parent 78e0a1cee7
commit e3643d6b6b
1 changed files with 66 additions and 60 deletions

View File

@ -3338,72 +3338,78 @@ bool MainWindow::judgeDiskSpace(QString currentPath)
void MainWindow::upgradeApp(QString pkgPath) void MainWindow::upgradeApp(QString pkgPath)
{ {
QString curPath = QDir::currentPath(); HGChar moduleName[256];
QString tmpPath = QDir::tempPath(); HGBase_GetModuleName(nullptr, moduleName, 256);
HGChar curPath2[256];
HGBase_GetFilePath(moduleName, curPath2, 256);
QString curPath(curPath2);
HGChar tmpPath2[256];
HGBase_GetTmpPath(tmpPath2, 256);
QString tmpPath(tmpPath2);
#if defined(HG_CMP_MSC) #if defined(HG_CMP_MSC)
#if defined(OEM_HANWANG) #if defined(OEM_HANWANG)
QFile::remove(tmpPath + "/HwUpgradeApp.exe"); QFile::remove(tmpPath + "HwUpgradeApp.exe");
QFile::copy(curPath + "/HwUpgradeApp.exe", tmpPath + "/HwUpgradeApp.exe"); QFile::copy(curPath + "HwUpgradeApp.exe", tmpPath + "HwUpgradeApp.exe");
QFile::remove(tmpPath + "/HwBase.dll"); QFile::remove(tmpPath + "HwBase.dll");
QFile::copy(curPath + "/HwBase.dll", tmpPath + "/HwBase.dll"); QFile::copy(curPath + "HwBase.dll", tmpPath + "HwBase.dll");
QFile::remove(tmpPath + "/HwVersion.dll"); QFile::remove(tmpPath + "HwVersion.dll");
QFile::copy(curPath + "/HwVersion.dll", tmpPath + "/HwVersion.dll"); QFile::copy(curPath + "HwVersion.dll", tmpPath + "HwVersion.dll");
#elif defined(OEM_LISICHENG) #elif defined(OEM_LISICHENG)
QFile::remove(tmpPath + "/LscUpgradeApp.exe"); QFile::remove(tmpPath + "LscUpgradeApp.exe");
QFile::copy(curPath + "/LscUpgradeApp.exe", tmpPath + "/LscUpgradeApp.exe"); QFile::copy(curPath + "LscUpgradeApp.exe", tmpPath + "LscUpgradeApp.exe");
QFile::remove(tmpPath + "/LscBase.dll"); QFile::remove(tmpPath + "LscBase.dll");
QFile::copy(curPath + "/LscBase.dll", tmpPath + "/LscBase.dll"); QFile::copy(curPath + "LscBase.dll", tmpPath + "LscBase.dll");
QFile::remove(tmpPath + "/LscVersion.dll"); QFile::remove(tmpPath + "LscVersion.dll");
QFile::copy(curPath + "/LscVersion.dll", tmpPath + "/LscVersion.dll"); QFile::copy(curPath + "LscVersion.dll", tmpPath + "LscVersion.dll");
#else #else
QFile::remove(tmpPath + "/HGUpgradeApp.exe"); QFile::remove(tmpPath + "HGUpgradeApp.exe");
QFile::copy(curPath + "/HGUpgradeApp.exe", tmpPath + "/HGUpgradeApp.exe"); QFile::copy(curPath + "HGUpgradeApp.exe", tmpPath + "HGUpgradeApp.exe");
QFile::remove(tmpPath + "/HGBase.dll"); QFile::remove(tmpPath + "HGBase.dll");
QFile::copy(curPath + "/HGBase.dll", tmpPath + "/HGBase.dll"); QFile::copy(curPath + "HGBase.dll", tmpPath + "HGBase.dll");
QFile::remove(tmpPath + "/HGVersion.dll"); QFile::remove(tmpPath + "HGVersion.dll");
QFile::copy(curPath + "/HGVersion.dll", tmpPath + "/HGVersion.dll"); QFile::copy(curPath + "HGVersion.dll", tmpPath + "HGVersion.dll");
#endif #endif
QFile::remove(tmpPath + "/msvcp140.dll"); QFile::remove(tmpPath + "msvcp140.dll");
QFile::copy(curPath + "/msvcp140.dll", tmpPath + "/msvcp140.dll"); QFile::copy(curPath + "msvcp140.dll", tmpPath + "msvcp140.dll");
QFile::remove(tmpPath + "/Qt5Core.dll"); QFile::remove(tmpPath + "Qt5Core.dll");
QFile::copy(curPath + "/Qt5Core.dll", tmpPath + "/Qt5Core.dll"); QFile::copy(curPath + "Qt5Core.dll", tmpPath + "Qt5Core.dll");
QFile::remove(tmpPath + "/Qt5Gui.dll"); QFile::remove(tmpPath + "Qt5Gui.dll");
QFile::copy(curPath + "/Qt5Gui.dll", tmpPath + "/Qt5Gui.dll"); QFile::copy(curPath + "Qt5Gui.dll", tmpPath + "Qt5Gui.dll");
QFile::remove(tmpPath + "/Qt5Widgets.dll"); QFile::remove(tmpPath + "Qt5Widgets.dll");
QFile::copy(curPath + "/Qt5Widgets.dll", tmpPath + "/Qt5Widgets.dll"); QFile::copy(curPath + "Qt5Widgets.dll", tmpPath + "Qt5Widgets.dll");
QFile::remove(tmpPath + "/vcruntime140.dll"); QFile::remove(tmpPath + "vcruntime140.dll");
QFile::copy(curPath + "/vcruntime140.dll", tmpPath + "/vcruntime140.dll"); QFile::copy(curPath + "vcruntime140.dll", tmpPath + "vcruntime140.dll");
QDir dir; QDir dir;
dir.mkdir(tmpPath + "/platforms"); dir.mkdir(tmpPath + "platforms");
QFile::remove(tmpPath + "/platforms/qwindows.dll"); QFile::remove(tmpPath + "platforms/qwindows.dll");
QFile::copy(curPath + "/platforms/qwindows.dll", tmpPath + "/platforms/qwindows.dll"); QFile::copy(curPath + "platforms/qwindows.dll", tmpPath + "platforms/qwindows.dll");
dir.mkdir(tmpPath + "/imageformats"); dir.mkdir(tmpPath + "imageformats");
QFile::remove(tmpPath + "/imageformats/qgif.dll"); QFile::remove(tmpPath + "imageformats/qgif.dll");
QFile::copy(curPath + "/imageformats/qgif.dll", tmpPath + "/imageformats/qgif.dll"); QFile::copy(curPath + "imageformats/qgif.dll", tmpPath + "imageformats/qgif.dll");
#else #else
#if defined(OEM_HANWANG) #if defined(OEM_HANWANG)
QFile::remove(tmpPath + "/HwUpgradeApp"); QFile::remove(tmpPath + "HwUpgradeApp");
QFile::copy(curPath + "/HwUpgradeApp", tmpPath + "/HwUpgradeApp"); QFile::copy(curPath + "HwUpgradeApp", tmpPath + "HwUpgradeApp");
QFile::remove(tmpPath + "/libHwBase.so"); //QFile::remove(tmpPath + "libHwBase.so");
QFile::copy(curPath + "/libHwBase.so", tmpPath + "/libHwBase.so"); //QFile::copy(curPath + "libHwBase.so", tmpPath + "libHwBase.so");
QFile::remove(tmpPath + "/libHwVersion.so"); //QFile::remove(tmpPath + "libHwVersion.so");
QFile::copy(curPath + "/libHwVersion.so", tmpPath + "/libHwVersion.so"); //QFile::copy(curPath + "libHwVersion.so", tmpPath + "libHwVersion.so");
#elif defined(OEM_LISICHENG) #elif defined(OEM_LISICHENG)
QFile::remove(tmpPath + "/LscUpgradeApp"); QFile::remove(tmpPath + "LscUpgradeApp");
QFile::copy(curPath + "/LscUpgradeApp", tmpPath + "/LscUpgradeApp"); QFile::copy(curPath + "LscUpgradeApp", tmpPath + "LscUpgradeApp");
QFile::remove(tmpPath + "/libLscBase.so"); //QFile::remove(tmpPath + "libLscBase.so");
QFile::copy(curPath + "/libLscBase.so", tmpPath + "/libLscBase.so"); //QFile::copy(curPath + "libLscBase.so", tmpPath + "libLscBase.so");
QFile::remove(tmpPath + "/libLscVersion.so"); //QFile::remove(tmpPath + "libLscVersion.so");
QFile::copy(curPath + "/libLscVersion.so", tmpPath + "/libLscVersion.so"); //QFile::copy(curPath + "libLscVersion.so", tmpPath + "libLscVersion.so");
#else #else
QFile::remove(tmpPath + "/HGUpgradeApp"); QFile::remove(tmpPath + "HGUpgradeApp");
QFile::copy(curPath + "/HGUpgradeApp", tmpPath + "/HGUpgradeApp"); QFile::copy(curPath + "HGUpgradeApp", tmpPath + "HGUpgradeApp");
QFile::remove(tmpPath + "/libHGBase.so"); //QFile::remove(tmpPath + "libHGBase.so");
QFile::copy(curPath + "/libHGBase.so", tmpPath + "/libHGBase.so"); //QFile::copy(curPath + "libHGBase.so", tmpPath + "libHGBase.so");
QFile::remove(tmpPath + "/libHGVersion.so"); //QFile::remove(tmpPath + "libHGVersion.so");
QFile::copy(curPath + "/libHGVersion.so", tmpPath + "/libHGVersion.so"); //QFile::copy(curPath + "libHGVersion.so", tmpPath + "libHGVersion.so");
#endif #endif
#endif #endif
@ -3417,19 +3423,19 @@ void MainWindow::upgradeApp(QString pkgPath)
#if defined(HG_CMP_MSC) #if defined(HG_CMP_MSC)
#if defined(OEM_HANWANG) #if defined(OEM_HANWANG)
isSuccessdStart = proc.startDetached(tmpPath + "/HwUpgradeApp.exe", argList); isSuccessdStart = proc.startDetached(tmpPath + "HwUpgradeApp.exe", argList);
#elif defined(OEM_LISICHENG) #elif defined(OEM_LISICHENG)
isSuccessdStart = proc.startDetached(tmpPath + "/LscUpgradeApp.exe", argList); isSuccessdStart = proc.startDetached(tmpPath + "LscUpgradeApp.exe", argList);
#else #else
isSuccessdStart = proc.startDetached(tmpPath + "/HGUpgradeApp.exe", argList); isSuccessdStart = proc.startDetached(tmpPath + "HGUpgradeApp.exe", argList);
#endif #endif
#else #else
#if defined(OEM_HANWANG) #if defined(OEM_HANWANG)
isSuccessdStart = proc.startDetached(tmpPath + "/HwUpgradeApp", argList); isSuccessdStart = proc.startDetached(tmpPath + "HwUpgradeApp", argList);
#elif defined(OEM_LISICHENG) #elif defined(OEM_LISICHENG)
isSuccessdStart = proc.startDetached(tmpPath + "/LscUpgradeApp", argList); isSuccessdStart = proc.startDetached(tmpPath + "LscUpgradeApp", argList);
#else #else
isSuccessdStart = proc.startDetached(tmpPath + "/HGUpgradeApp", argList); isSuccessdStart = proc.startDetached(tmpPath + "HGUpgradeApp", argList);
#endif #endif
#endif #endif