openUrl全路径转换
This commit is contained in:
@@ -29,11 +29,12 @@ namespace dl::Win32
|
||||
|
||||
bool OpenUrl(std::string_view url,
|
||||
std::string_view cmd,
|
||||
std::string_view work_path)
|
||||
std::string_view work_path,
|
||||
bool convert_absolute)
|
||||
{
|
||||
std::string gbk_exe = dl::CodeCvt::Utf8ToMultiByte(dl::File::GetPathAbsolute(url));
|
||||
std::string gbk_cmd = dl::CodeCvt::Utf8ToMultiByte(dl::File::GetPathAbsolute(cmd));
|
||||
std::string gbk_path = dl::CodeCvt::Utf8ToMultiByte(dl::File::GetPathAbsolute(work_path));
|
||||
std::string gbk_exe = dl::CodeCvt::Utf8ToMultiByte(convert_absolute ? dl::File::GetPathAbsolute(url) : url);
|
||||
std::string gbk_cmd = dl::CodeCvt::Utf8ToMultiByte(convert_absolute ? dl::File::GetPathAbsolute(cmd) : cmd);
|
||||
std::string gbk_path = dl::CodeCvt::Utf8ToMultiByte(convert_absolute ? dl::File::GetPathAbsolute(work_path) : work_path);
|
||||
HINSTANCE h = ShellExecuteA(NULL, "open", gbk_exe.c_str(), gbk_cmd.c_str(), gbk_path.c_str(), SW_SHOW);
|
||||
if ((int)h <= 32)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace dl::Win32
|
||||
//! 打开网页、文件夹、文件、程序
|
||||
bool OpenUrl(std::string_view url,
|
||||
std::string_view cmd = {},
|
||||
std::string_view work_path = {});
|
||||
std::string_view work_path = {},
|
||||
bool convert_absolute = true);
|
||||
// 常用路径检测文件是否存在
|
||||
enum WindowsSearchType
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user