diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index 32d0f573..e0aa7881 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -1101,46 +1101,70 @@ void MainWindow::on_upgradeApp(QString pkgPath) { QString curPath = QDir::currentPath(); QString tmpPath = QDir::tempPath(); - QFile file(curPath); #if defined(HG_CMP_MSC) #if defined(OEM_HANWANG) - file.copy("HwUpgradeApp.exe", tmpPath + "/HwUpgradeApp.exe"); - file.copy("HwBase.dll", tmpPath + "/HwBase.dll"); - file.copy("HwVersion.dll", tmpPath + "/HwVersion.dll"); + QFile::remove(tmpPath + "/HwUpgradeApp.exe"); + QFile::copy(curPath + "/HwUpgradeApp.exe", tmpPath + "/HwUpgradeApp.exe"); + QFile::remove(tmpPath + "/HwBase.dll"); + QFile::copy(curPath + "/HwBase.dll", tmpPath + "/HwBase.dll"); + QFile::remove(tmpPath + "/HwVersion.dll"); + QFile::copy(curPath + "/HwVersion.dll", tmpPath + "/HwVersion.dll"); #elif defined(OEM_LISICHENG) - file.copy("LscUpgradeApp.exe", tmpPath + "/LscUpgradeApp.exe"); - file.copy("LscBase.dll", tmpPath + "/LscBase.dll"); - file.copy("LscVersion.dll", tmpPath + "/LscVersion.dll"); + QFile::remove(tmpPath + "/LscUpgradeApp.exe"); + QFile::copy(curPath + "/LscUpgradeApp.exe", tmpPath + "/LscUpgradeApp.exe"); + QFile::remove(tmpPath + "/LscBase.dll"); + QFile::copy(curPath + "/LscBase.dll", tmpPath + "/LscBase.dll"); + QFile::remove(tmpPath + "/LscVersion.dll"); + QFile::copy(curPath + "/LscVersion.dll", tmpPath + "/LscVersion.dll"); #else - file.copy("HGUpgradeApp.exe", tmpPath + "/HGUpgradeApp.exe"); - file.copy("HGBase.dll", tmpPath + "/HGBase.dll"); - file.copy("HGVersion.dll", tmpPath + "/HGVersion.dll"); + QFile::remove(tmpPath + "/HGUpgradeApp.exe"); + QFile::copy(curPath + "/HGUpgradeApp.exe", tmpPath + "/HGUpgradeApp.exe"); + QFile::remove(tmpPath + "/HGBase.dll"); + QFile::copy(curPath + "/HGBase.dll", tmpPath + "/HGBase.dll"); + QFile::remove(tmpPath + "/HGVersion.dll"); + QFile::copy(curPath + "/HGVersion.dll", tmpPath + "/HGVersion.dll"); #endif - file.copy("msvcp140.dll", tmpPath + "/msvcp140.dll"); - file.copy("Qt5Core.dll", tmpPath + "/Qt5Core.dll"); - file.copy("Qt5Gui.dll", tmpPath + "/Qt5Gui.dll"); - file.copy("Qt5Widgets.dll", tmpPath + "/Qt5Widgets.dll"); - file.copy("vcruntime140.dll", tmpPath + "/vcruntime140.dll"); - QDir dir; - dir.mkdir(tmpPath + "/platforms"); - file.copy("platforms/qwindows.dll", tmpPath + "/platforms/qwindows.dll"); - dir.mkdir(tmpPath + "/imageformats"); - file.copy("imageformats/qgif.dll", tmpPath + "/imageformats/qgif.dll"); + QFile::remove(tmpPath + "/msvcp140.dll"); + QFile::copy(curPath + "/msvcp140.dll", tmpPath + "/msvcp140.dll"); + QFile::remove(tmpPath + "/Qt5Core.dll"); + QFile::copy(curPath + "/Qt5Core.dll", tmpPath + "/Qt5Core.dll"); + QFile::remove(tmpPath + "/Qt5Gui.dll"); + QFile::copy(curPath + "/Qt5Gui.dll", tmpPath + "/Qt5Gui.dll"); + QFile::remove(tmpPath + "/Qt5Widgets.dll"); + QFile::copy(curPath + "/Qt5Widgets.dll", tmpPath + "/Qt5Widgets.dll"); + QFile::remove(tmpPath + "/vcruntime140.dll"); + QFile::copy(curPath + "/vcruntime140.dll", tmpPath + "/vcruntime140.dll"); + QDir dir; + dir.mkdir(tmpPath + "/platforms"); + QFile::remove(tmpPath + "/platforms/qwindows.dll"); + QFile::copy(curPath + "/platforms/qwindows.dll", tmpPath + "/platforms/qwindows.dll"); + dir.mkdir(tmpPath + "/imageformats"); + QFile::remove(tmpPath + "/imageformats/qgif.dll"); + QFile::copy(curPath + "/imageformats/qgif.dll", tmpPath + "/imageformats/qgif.dll"); #else #if defined(OEM_HANWANG) - file.copy("HwUpgradeApp", tmpPath + "/HwUpgradeApp"); - file.copy("libHwBase.so", tmpPath + "/libHwBase.so"); - file.copy("libHwVersion.so", tmpPath + "/libHwVersion.so"); + QFile::remove(tmpPath + "/HwUpgradeApp"); + QFile::copy(curPath + "/HwUpgradeApp", tmpPath + "/HwUpgradeApp"); + QFile::remove(tmpPath + "/libHwBase.so"); + QFile::copy(curPath + "/libHwBase.so", tmpPath + "/libHwBase.so"); + QFile::remove(tmpPath + "/libHwVersion.so"); + QFile::copy(curPath + "/libHwVersion.so", tmpPath + "/libHwVersion.so"); #elif defined(OEM_LISICHENG) - file.copy("LscUpgradeApp", tmpPath + "/LscUpgradeApp"); - file.copy("libLscBase.so", tmpPath + "/libLscBase.so"); - file.copy("libLscVersion.so", tmpPath + "/libLscVersion.so"); + QFile::remove(tmpPath + "/LscUpgradeApp"); + QFile::copy(curPath + "/LscUpgradeApp", tmpPath + "/LscUpgradeApp"); + QFile::remove(tmpPath + "/libLscBase.so"); + QFile::copy(curPath + "/libLscBase.so", tmpPath + "/libLscBase.so"); + QFile::remove(tmpPath + "/libLscVersion.so"); + QFile::copy(curPath + "/libLscVersion.so", tmpPath + "/libLscVersion.so"); #else - file.copy("HGUpgradeApp", tmpPath + "/HGUpgradeApp"); - file.copy("libHGBase.so", tmpPath + "/libHGBase.so"); - file.copy("libHGVersion.so", tmpPath + "/libHGVersion.so"); + QFile::remove(tmpPath + "/HGUpgradeApp"); + QFile::copy(curPath + "/HGUpgradeApp", tmpPath + "/HGUpgradeApp"); + QFile::remove(tmpPath + "/libHGBase.so"); + QFile::copy(curPath + "/libHGBase.so", tmpPath + "/libHGBase.so"); + QFile::remove(tmpPath + "/libHGVersion.so"); + QFile::copy(curPath + "/libHGVersion.so", tmpPath + "/libHGVersion.so"); #endif #endif @@ -3234,10 +3258,15 @@ void MainWindow::on_actionact_update_triggered() assert(!url.isEmpty() && !md5.isEmpty()); + HGChar suffix[64]; + HGBase_GetFileSuffix(url.toStdString().c_str(), suffix, 64); + HGChar savePath[512]; HGBase_GetConfigPath(savePath, 512); HGBase_CreateDir(savePath); - strcat(savePath, (versionNum + QString("%1").arg(".exe")).toLatin1().data()); + HGChar fileName[128]; + sprintf(fileName, "%s.%s", versionNum.toStdString().c_str(), suffix); + strcat(savePath, fileName); QFile saveFile(savePath); saveFile.open(QFile::ReadOnly); diff --git a/app/upgrade/HGUpgrade.cpp b/app/upgrade/HGUpgrade.cpp index 3b86611f..8dba1d47 100644 --- a/app/upgrade/HGUpgrade.cpp +++ b/app/upgrade/HGUpgrade.cpp @@ -80,15 +80,28 @@ bool AppIsRun(const std::string& appName) std::string cmd; std::string appPath; - #if defined(OEM_HANWANG) - cmd = "ps -wef | grep HanvonScan"; - appPath = "/opt/apps/com.hanvonchina.hanvonscan/files/bin/HanvonScan"; - #elif defined(OEM_LISICHENG) - cmd = "ps -wef | grep LanxumScan"; - appPath = "/opt/apps/com.lanxumchina.lanxumscan/files/bin/LanxumScan"; + #if defined (UOS) + #if defined(OEM_HANWANG) + cmd = "ps -wef | grep HanvonScan"; + appPath = "/opt/apps/com.hanvonchina.hanvonscan/files/bin/HanvonScan"; + #elif defined(OEM_LISICHENG) + cmd = "ps -wef | grep LanxumScan"; + appPath = "/opt/apps/com.lanxumchina.lanxumscan/files/bin/LanxumScan"; + #else + cmd = "ps -wef | grep HuaGoScan"; + appPath = "/opt/apps/com.huagaochina.huagoscan/files/bin/HuaGoScan"; + #endif #else - cmd = "ps -wef | grep HuaGoScan"; - appPath = "/opt/apps/com.huagaochina.huagoscan/files/bin/HuaGoScan"; + #if defined(OEM_HANWANG) + cmd = "ps -wef | grep HanvonScan"; + appPath = "/opt/apps/scanner-driver-hanvon/HanvonScan"; + #elif defined(OEM_LISICHENG) + cmd = "ps -wef | grep LanxumScan"; + appPath = "/opt/apps/scanner-driver-lanxum/LanxumScan"; + #else + cmd = "ps -wef | grep HuaGoScan"; + appPath = "/opt/apps/scanner-driver-huagao/HuaGoScan"; + #endif #endif bool ret = false; @@ -184,12 +197,22 @@ void RunApp(const std::string& appName) #else std::string appPath; - #if defined(OEM_HANWANG) - appPath = "sh /opt/apps/com.hanvonchina.hanvonscan/files/bin/HanvonScan.sh &"; - #elif defined(OEM_LISICHENG) - appPath = "sh /opt/apps/com.lanxumchina.lanxumscan/files/bin/LanxumScan.sh &"; + #if defined (UOS) + #if defined(OEM_HANWANG) + appPath = "sh /opt/apps/com.hanvonchina.hanvonscan/files/bin/HanvonScan.sh &"; + #elif defined(OEM_LISICHENG) + appPath = "sh /opt/apps/com.lanxumchina.lanxumscan/files/bin/LanxumScan.sh &"; + #else + appPath = "sh /opt/apps/com.huagaochina.huagoscan/files/bin/HuaGoScan.sh &"; + #endif #else - appPath = "sh /opt/apps/com.huagaochina.huagoscan/files/bin/HuaGoScan.sh &"; + #if defined(OEM_HANWANG) + appPath = "sh /opt/apps/scanner-driver-hanvon/HanvonScan.sh &"; + #elif defined(OEM_LISICHENG) + appPath = "sh /opt/apps/scanner-driver-lanxum/LanxumScan.sh &"; + #else + appPath = "sh /opt/apps/scanner-driver-huagao/HuaGoScan.sh &"; + #endif #endif system(appPath.c_str());