fix: fix error compile and run on Linux
This commit is contained in:
parent
71dbaa1812
commit
c3afba04c1
@ -4,8 +4,8 @@ project(msync LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH "D:/library/wxWidgets/lib/cmake")
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH "D:/library/wxWidgets")
|
||||
list(APPEND CMAKE_PREFIX_PATH "/home/lebo/library/wxWidgets")
|
||||
if (MSVC)
|
||||
add_compile_options(/source-charset:utf-8)
|
||||
endif()
|
||||
@ -18,4 +18,4 @@ message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
|
||||
add_executable(msync main.cpp)
|
||||
target_link_libraries(msync PRIVATE ${wxWidgets_LIBRARIES})
|
||||
set_target_properties(msync PROPERTIES WIN32_EXECUTABLE FALSE)
|
||||
set_target_properties(msync PROPERTIES WIN32_EXECUTABLE FALSE)
|
||||
|
12
main.cpp
12
main.cpp
@ -58,10 +58,10 @@ bool parse_xml(const wxString& filepath, const wxString& name,
|
||||
break;
|
||||
}
|
||||
if (!find) {
|
||||
wxLogMessage("未找到%s的配置。", name);
|
||||
wxLogMessage(wxT("未找到%s的配置。"), name);
|
||||
return false;
|
||||
} else {
|
||||
wxLogMessage("找到%s的配置。", name);
|
||||
wxLogMessage(wxT("找到%s的配置。"), name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -95,8 +95,6 @@ wxString get_cmd(Configure& config, bool to_cur)
|
||||
cmd_str.append(cmd);
|
||||
#else
|
||||
cmd_str.append("rsync ");
|
||||
dest_str = work_path + config.name;
|
||||
source_str = config.work_dir + config.name;
|
||||
#endif
|
||||
|
||||
cmd_str.append("-av");
|
||||
@ -163,11 +161,11 @@ int main(int argc, char* argv[])
|
||||
wxArrayString output;
|
||||
// 使用 wxExecute 执行命令
|
||||
long result = wxExecute(command, output, wxEXEC_SYNC);
|
||||
wxLogMessage("命令执行结果:%d", result);
|
||||
wxLogMessage(wxT("命令执行结果:%ld"), result);
|
||||
wxString out_str;
|
||||
for (const auto& data : output) {
|
||||
out_str.append(data + "\n");
|
||||
}
|
||||
wxLogMessage("命令输出:%s", out_str);
|
||||
wxLogMessage(wxT("命令输出:\n%s\n"), out_str);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user