Search in sources :

Example 6 with WinePrefixContainerDTO

use of org.phoenicis.containers.dto.WinePrefixContainerDTO in project POL-POM-5 by PlayOnLinux.

the class WinePrefixContainerController method runInPrefix.

public void runInPrefix(WinePrefixContainerDTO winePrefix, String command, Runnable doneCallback, Consumer<Exception> errorCallback) {
    final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
    interactiveScriptSession.eval("include([\"Functions\", \"Engines\", \"Wine\"]);", ignored -> interactiveScriptSession.eval("new Wine()", output -> {
        final ScriptObjectMirror wine = (ScriptObjectMirror) output;
        wine.callMember("prefix", winePrefix.getName());
        wine.callMember("run", command);
        wine.callMember("wait");
        doneCallback.run();
    }, errorCallback), errorCallback);
}
Also used : ShortcutCategoryDTO(org.phoenicis.library.dto.ShortcutCategoryDTO) RegistryWriter(org.phoenicis.win32.registry.RegistryWriter) Logger(org.slf4j.Logger) FileUtilities(org.phoenicis.tools.files.FileUtilities) LoggerFactory(org.slf4j.LoggerFactory) ScriptInterpreter(org.phoenicis.scripts.interpreter.ScriptInterpreter) IOException(java.io.IOException) HashMap(java.util.HashMap) File(java.io.File) Consumer(java.util.function.Consumer) TerminalOpener(org.phoenicis.tools.system.terminal.TerminalOpener) List(java.util.List) RegistryParameter(org.phoenicis.containers.wine.parameters.RegistryParameter) ShortcutManager(org.phoenicis.library.ShortcutManager) Map(java.util.Map) WinePrefixContainerDTO(org.phoenicis.containers.dto.WinePrefixContainerDTO) OperatingSystemFetcher(org.phoenicis.tools.system.OperatingSystemFetcher) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession) LibraryManager(org.phoenicis.library.LibraryManager) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession)

Aggregations

File (java.io.File)6 IOException (java.io.IOException)6 HashMap (java.util.HashMap)6 List (java.util.List)6 Map (java.util.Map)6 Consumer (java.util.function.Consumer)6 ScriptObjectMirror (jdk.nashorn.api.scripting.ScriptObjectMirror)6 WinePrefixContainerDTO (org.phoenicis.containers.dto.WinePrefixContainerDTO)6 RegistryParameter (org.phoenicis.containers.wine.parameters.RegistryParameter)6 LibraryManager (org.phoenicis.library.LibraryManager)6 ShortcutManager (org.phoenicis.library.ShortcutManager)6 ShortcutCategoryDTO (org.phoenicis.library.dto.ShortcutCategoryDTO)6 InteractiveScriptSession (org.phoenicis.scripts.interpreter.InteractiveScriptSession)6 ScriptInterpreter (org.phoenicis.scripts.interpreter.ScriptInterpreter)6 FileUtilities (org.phoenicis.tools.files.FileUtilities)6 OperatingSystemFetcher (org.phoenicis.tools.system.OperatingSystemFetcher)6 TerminalOpener (org.phoenicis.tools.system.terminal.TerminalOpener)6 RegistryWriter (org.phoenicis.win32.registry.RegistryWriter)6 Logger (org.slf4j.Logger)6 LoggerFactory (org.slf4j.LoggerFactory)6