mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
FIX: use shellex to open file, avoid cmd window
Change-Id: I6ae868381003c85a319e9c3bad37b0bffc3dbdd7
This commit is contained in:
parent
946ba89cd7
commit
48083f7c0c
4 changed files with 36 additions and 1 deletions
|
@ -8,6 +8,9 @@
|
|||
|
||||
#include <wx/dcgraph.h>
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include "../Utils/MacDarkMode.hpp"
|
||||
#endif
|
||||
|
@ -149,8 +152,15 @@ void Slic3r::GUI::ImageGrid::DoAction(size_t index, int action)
|
|||
auto &file = m_file_sys->GetFile(index);
|
||||
if (file.IsDownload() && file.progress >= -1) {
|
||||
if (file.progress >= 100) {
|
||||
if (!m_file_sys->DownloadCheckFile(index)) {
|
||||
wxMessageBox(wxString::Format(_L("File '%s' was lost! Please download it again."), from_u8(file.name)), _L("Error"), wxOK);
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
#ifdef __WXMSW__
|
||||
wxExecute("cmd /c start " + from_u8(file.path), wxEXEC_HIDE_CONSOLE);
|
||||
auto wfile = boost::filesystem::path(file.path).wstring();
|
||||
SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"open", wfile.c_str(), L"", SW_HIDE};
|
||||
::ShellExecuteEx(&info);
|
||||
#else
|
||||
wxShell("open " + file.path);
|
||||
#endif
|
||||
|
@ -166,6 +176,11 @@ void Slic3r::GUI::ImageGrid::DoAction(size_t index, int action)
|
|||
auto &file = m_file_sys->GetFile(index);
|
||||
if (file.IsDownload() && file.progress >= -1) {
|
||||
if (file.progress >= 100) {
|
||||
if (!m_file_sys->DownloadCheckFile(index)) {
|
||||
wxMessageBox(wxString::Format(_L("File '%s' was lost! Please download it again."), from_u8(file.name)), _L("Error"), wxOK);
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
#ifdef __WIN32__
|
||||
wxExecute(L"explorer.exe /select," + from_u8(file.path));
|
||||
#elif __APPLE__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue