@@ -7,7 +7,7 @@ include(["utils", "functions", "net", "resource"]);
77/* exported LATEST_STABLE_VERSION */
88var LATEST_STABLE_VERSION = "3.0.2" ;
99/* exported LATEST_DEVELOPMENT_VERSION */
10- var LATEST_DEVELOPMENT_VERSION = "3.13 " ;
10+ var LATEST_DEVELOPMENT_VERSION = "3.15 " ;
1111/* exported LATEST_STAGING_VERSION */
1212var LATEST_STAGING_VERSION = "3.2" ;
1313
@@ -128,11 +128,20 @@ Wine.prototype.binPath = function (subCategory, version) {
128128
129129/**
130130*
131- * @param executable
132- * @param args
131+ * @param {string } executable
132+ * @param {array } [args = []]
133+ * @param {boolean } [wait=false]
133134*/
134- Wine . prototype . runInsidePrefix = function ( executable , args ) {
135- return this . run ( this . prefixDirectory ( ) + "/drive_c/" + executable , args , this . prefixDirectory ( ) , false , true ) ;
135+ Wine . prototype . runInsidePrefix = function ( executable , args , wait ) {
136+ if ( ! args ) {
137+ args = [ ] ;
138+ } else if ( typeof args === 'string' || args instanceof String ) {
139+ args = [ args ] ;
140+ }
141+ if ( ! wait ) {
142+ wait = false ;
143+ }
144+ return this . run ( this . prefixDirectory ( ) + "/drive_c/" + executable , args , this . prefixDirectory ( ) , false , wait ) ;
136145} ;
137146
138147/**
@@ -207,12 +216,48 @@ Wine.prototype.programFiles = function () {
207216 }
208217} ;
209218
219+ /**
220+ * executes wineserver in current prefix
221+ * @param {string } wineserver parameter
222+ */
223+ Wine . prototype . wineServer = function ( parameter ) {
224+ var workingContainerDirectory = this . _implementation . getContainerDirectory ( this . _implementation . getWorkingContainer ( ) ) ;
225+ if ( fileExists ( workingContainerDirectory ) ) {
226+ var configFactory = Bean ( "compatibleConfigFileFormatFactory" ) ;
227+ var containerConfiguration = configFactory . open ( workingContainerDirectory + "/phoenicis.cfg" ) ;
228+ var distribution = containerConfiguration . readValue ( "wineDistribution" , "upstream" ) ;
229+ var architecture = containerConfiguration . readValue ( "wineArchitecture" , "x86" ) ;
230+ var operatingSystem = this . _OperatingSystemFetcher . fetchCurrentOperationSystem ( ) . getWinePackage ( ) ;
231+ var subCategory = distribution + "-" + operatingSystem + "-" + architecture ;
232+ var version = containerConfiguration . readValue ( "wineVersion" ) ;
233+ var binary = this . _implementation . getLocalDirectory ( subCategory , version ) + "/bin/wineserver" ;
234+ var processBuilder = new java . lang . ProcessBuilder ( Java . to ( [ binary , parameter ] , "java.lang.String[]" ) ) ;
235+ var environment = processBuilder . environment ( ) ;
236+ environment . put ( "WINEPREFIX" , this . _implementation . getContainerDirectory ( this . _implementation . getWorkingContainer ( ) ) ) ;
237+ processBuilder . inheritIO ( ) ;
238+ var wineServerProcess = processBuilder . start ( ) ;
239+ wineServerProcess . waitFor ( ) ;
240+ }
241+ else {
242+ print ( "Wine prefix \"" + this . getWorkingContainer ( ) + "\" does not exist!" ) ;
243+ }
244+ } ;
245+
246+ /**
247+ * wait until wineserver finishes
248+ * @returns {Wine }
249+ */
250+ Wine . prototype . wait = function ( ) {
251+ this . wineServer ( "-w" ) ;
252+ return this ;
253+ } ;
254+
210255/**
211256* kill wine server
212257* @returns {Wine }
213258*/
214259Wine . prototype . kill = function ( ) {
215- this . _wineServer ( "-k" ) ;
260+ this . wineServer ( "-k" ) ;
216261 return this ;
217262} ;
218263
0 commit comments