Browse Source

Fix editScript() on Mac. Disable "Edit script" menu item when editor is not set.

tags/v1.3.0
Andrew Belt 4 years ago
parent
commit
f7a2cf2177
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      src/Prototype.cpp

+ 7
- 4
src/Prototype.cpp View File

@@ -468,11 +468,14 @@ struct Prototype : Module {
if (path.empty())
return;
// Launch editor and detach
std::string command = editorPath + " \"" + path + "\"";
#if defined ARCH_LIN || defined ARCH_MAC
command += " &";
#if defined ARCH_LIN
std::string command = editorPath + " \"" + path + "\" &";
std::system(command.c_str());
#elif defined ARCH_MAC
std::string command = "open -a " + editorPath + " \"" + path + "\" &";
std::system(command.c_str());
#elif defined ARCH_WIN
std::string command = editorPath + " \"" + path + "\"";
std::wstring commandW = string::toWstring(command);
STARTUPINFOW startupInfo;
std::memset(&startupInfo, 0, sizeof(startupInfo));
@@ -536,7 +539,7 @@ struct Prototype : Module {
};
EditScriptItem* editScriptItem = createMenuItem<EditScriptItem>("Edit script");
editScriptItem->module = this;
editScriptItem->disabled = !doesPathExist();
editScriptItem->disabled = !doesPathExist() || editorPath == "";
menu->addChild(editScriptItem);

struct SetEditorItem : MenuItem {


Loading…
Cancel
Save