diff --git a/Editor/src/Windows/EditorSelectionPanel.cpp b/Editor/src/Windows/EditorSelectionPanel.cpp index 5d53f6b1..3485a403 100644 --- a/Editor/src/Windows/EditorSelectionPanel.cpp +++ b/Editor/src/Windows/EditorSelectionPanel.cpp @@ -426,9 +426,16 @@ void EditorSelectionPanel::DrawWrenScriptPanel(Ref wrenFile) { auto filePath = wrenFile->GetFile()->GetAbsolutePath(); std::string fileContent = Nuake::FileSystem::ReadFile(filePath, true); - + ImGui::Text("Content"); + ImGui::SameLine(ImGui::GetWindowWidth()-90); + if(ImGui::Button("Open In...")) + { + Nuake::OS::OpenIn(filePath); + } + ImGui::Separator(); + ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetWindowWidth()); ImGui::Text(fileContent.c_str(), ImGui::GetWindowWidth()); diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 4b309547..b3b3db26 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -181,6 +181,16 @@ namespace Nuake OS::ShowInFileExplorer(file->GetAbsolutePath()); } + if(file->GetExtension() == ".wren") + { + ImGui::Separator(); + + if(ImGui::MenuItem("Open In...")) + { + OS::OpenIn(file->GetAbsolutePath()); + } + } + if(file->GetExtension() != ".project") { ImGui::Separator(); diff --git a/Nuake/src/Core/OS.cpp b/Nuake/src/Core/OS.cpp index 40721cda..a59ee64c 100644 --- a/Nuake/src/Core/OS.cpp +++ b/Nuake/src/Core/OS.cpp @@ -10,6 +10,11 @@ int OS::GetTime() return static_cast(std::chrono::system_clock::now().time_since_epoch().count()); } +void OS::OpenIn(const std::string& filePath) +{ + ShellExecuteA(nullptr, "open", filePath.c_str(), nullptr, nullptr, SW_SHOWDEFAULT); +} + void OS::ShowInFileExplorer(const std::string& filePath) { ShellExecuteA(nullptr, "open", "explorer.exe", ("/select," + std::string(filePath)).c_str(), nullptr, SW_SHOWDEFAULT); diff --git a/Nuake/src/Core/OS.h b/Nuake/src/Core/OS.h index c2fdbaf3..71f80d21 100644 --- a/Nuake/src/Core/OS.h +++ b/Nuake/src/Core/OS.h @@ -8,6 +8,7 @@ namespace Nuake { public: static int GetTime(); + static void OpenIn(const std::string& filePath); static void ShowInFileExplorer(const std::string& filePath); }; }