国产系统system命令打开pdf文件需要加特定符号标识

This commit is contained in:
yangjiaxuan 2023-08-21 18:27:46 +08:00
parent e5311b9175
commit bdb975bdfb
1 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
#include "hg_scanner.h" #include "hg_scanner.h"
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#include "sane/sane_option_definitions.h" #include "sane/sane_option_definitions.h"
#include "scanner_setting.h" #include "scanner_setting.h"
@ -1657,8 +1657,11 @@ int hg_scanner::setting_help(void* data, long* len)
{ {
std::string helpfile = get_help_file_path(); std::string helpfile = get_help_file_path();
std::string com = "xdg-open ";//注意空格保留
int ret = SCANNER_ERR_OK; int ret = SCANNER_ERR_OK;
#if defined(WIN32) || defined(_WIN64) #if defined(WIN32) || defined(_WIN64)
com = "";
FILE* src = fopen(helpfile.c_str(), "rb"); FILE* src = fopen(helpfile.c_str(), "rb");
if (src) if (src)
fclose(src); fclose(src);
@ -1672,10 +1675,12 @@ int hg_scanner::setting_help(void* data, long* len)
return ret ; return ret ;
} }
com += helpfile;
#if defined(WIN32) || defined(_WIN64) #if defined(WIN32) || defined(_WIN64)
ShellExecuteA(NULL, "Open", helpfile.c_str(), NULL, NULL, SW_SHOWNORMAL); ShellExecuteA(NULL, "Open", com.c_str(), NULL, NULL, SW_SHOWNORMAL);
#else #else
system(helpfile.c_str()); system(com.c_str());
#endif #endif
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO,"scanSettings_Help_pdf Path is:%s %d\r\n",helpfile.c_str(), 1); VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO,"scanSettings_Help_pdf Path is:%s %d\r\n",helpfile.c_str(), 1);
return ret; return ret;