invoke entries with exe files

This commit is contained in:
2023-12-25 13:51:11 -07:00
parent 14e7ba2e56
commit a705f8bc74
2 changed files with 12 additions and 1 deletions

View File

@@ -6,9 +6,11 @@ import kiss.Stream;
import nat.components.Position;
import haxe.Constraints;
import haxe.DynamicAccess;
import haxe.io.Path;
import uuid.Uuid;
import nat.systems.*;
import nat.components.*;
using StringTools;
enum CommandArgType {
// When called interactively, automatically pass the currently selected Entry(s) to the function

View File

@@ -544,6 +544,8 @@
(addEntryLink archive e linkTo)))
(defCommand InvokeEntry [e SelectedEntry]
(localFunction noInvocation []
(ui.displayMessage "tried to invoke ${e.id} but it has no available actions"))
(cond
((hasComponent e EntryLink)
(InvokeEntry (dictGet archive.entries (readComponent e EntryLink))))
@@ -551,8 +553,15 @@
(tryRunCommand (readComponent e NATCommand)) 0)
((hasComponent e NATCommands)
(tryRunCommands (readComponent e NATCommands)) 0)
// Start .exe files
(e.files
(doFor file e.files
(when (file.endsWith ".exe")
(tryProcess (Path.withoutDirectory file) [] ->error (ui.displayMessage "Error launching exe ${file}: $error") null false (Path.directory file))
(return [e])))
(noInvocation) 0)
(true
(ui.displayMessage "tried to invoke ${e.id} but it has no available actions") 0))
(noInvocation) 0))
[e])
)