NK-113 - Open Wren Script File with Double Click

This commit is contained in:
émeryc
2023-07-17 20:21:15 -04:00
parent 90244777e4
commit 7baec67bf4
2 changed files with 15 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ public:
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Script"))
{
char* file = (char*)payload->Data;
std::string fullPath = std::string(file, 512);
path = Nuake::FileSystem::AbsoluteToRelative(std::move(fullPath));
@@ -37,6 +37,16 @@ public:
}
component.Script = path;
// Double click on file
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
{
if(!component.Script.empty())
{
Nuake::OS::OpenIn(component.mWrenScript->GetFile()->GetAbsolutePath());
}
}
ImGui::TableNextColumn();
ComponentTableReset(component.Script, "");

View File

@@ -39,7 +39,10 @@ namespace Nuake
if (j.contains("Script"))
{
Script = j["Script"];
LoadScript(Script);
if(!Script.empty())
{
LoadScript(Script);
}
}
if (j.contains("mModule"))