Index: binaries/data/mods/public/gui/replaymenu/replay_actions.js =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_actions.js +++ binaries/data/mods/public/gui/replaymenu/replay_actions.js @@ -35,6 +35,30 @@ } /** + * Copies the selected replay's file path to the clipboard. + */ +function copyReplayFilePath() +{ + var selected = Engine.GetGUIObjectByName("replaySelection").selected; + if (selected == -1) + return; + + Engine.CopyTextClipboard(Engine.GetReplayDirectoryName(g_ReplaysFiltered[selected].directory)); +} + +/** + * Opens the selected replay in the users preferred application for files. + */ +function openReplayDirectory() +{ + var selected = Engine.GetGUIObjectByName("replaySelection").selected; + if (selected == -1) + return; + + Engine.OpenURL(Engine.GetReplayDirectoryName(g_ReplaysFiltered[selected].directory)); +} + +/** * Starts the selected visual replay, or shows an error message in case of incompatibility. */ function startReplay() Index: binaries/data/mods/public/gui/replaymenu/replay_menu.js =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_menu.js +++ binaries/data/mods/public/gui/replaymenu/replay_menu.js @@ -269,6 +269,8 @@ Engine.GetGUIObjectByName("replayInfoEmpty").hidden = replaySelected; Engine.GetGUIObjectByName("startReplayButton").enabled = replaySelected; Engine.GetGUIObjectByName("deleteReplayButton").enabled = replaySelected; + Engine.GetGUIObjectByName("copyFilePathButton").hidden = !replaySelected; + Engine.GetGUIObjectByName("openReplayDirectoryButton").hidden = !replaySelected; Engine.GetGUIObjectByName("replayFilename").hidden = !replaySelected; Engine.GetGUIObjectByName("summaryButton").hidden = true; Index: binaries/data/mods/public/gui/replaymenu/replay_menu.xml =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_menu.xml +++ binaries/data/mods/public/gui/replaymenu/replay_menu.xml @@ -52,7 +52,7 @@ - - - File path for the currently selected replay. + + + + + Copies the file path for the currently selected replay to your clipboard. + copyReplayFilePath(); + + + + + + + Opens the file directory for the currently selected replay. + openReplayDirectory(); + + + + + + + File path for the currently selected replay. + + @@ -197,7 +217,7 @@ - + Index: source/ps/scripting/JSInterface_Main.cpp =================================================================== --- source/ps/scripting/JSInterface_Main.cpp +++ source/ps/scripting/JSInterface_Main.cpp @@ -63,6 +63,11 @@ sys_open_url(url); } +void CopyTextClipboard(const std::string& Text) +{ + SDL_SetClipboardText(Text.c_str()); +} + std::wstring GetSystemUsername() { return sys_get_user_name(); @@ -125,6 +130,7 @@ ScriptFunction::Register<&AtlasIsAvailable>(rq, "AtlasIsAvailable"); ScriptFunction::Register<&IsAtlasRunning>(rq, "IsAtlasRunning"); ScriptFunction::Register<&OpenURL>(rq, "OpenURL"); + ScriptFunction::Register<&CopyTextClipboard>(rq, "CopyTextClipboard"); ScriptFunction::Register<&GetSystemUsername>(rq, "GetSystemUsername"); ScriptFunction::Register<&GetMatchID>(rq, "GetMatchID"); ScriptFunction::Register<&LoadMapSettings>(rq, "LoadMapSettings");