Set a marker system property on applications when they're run through getdown.
Also: good style is to use the result of Collection.toArray(), not the array you pass it. There is no guarantee it will *use* your array...
This commit is contained in:
@@ -782,6 +782,9 @@ public class Application
|
||||
args.add("-Dhttp.proxyPort=" + System.getProperty("http.proxyPort"));
|
||||
}
|
||||
|
||||
// add the marker indicating the app is running in getdown
|
||||
args.add("-D" + Properties.GETDOWN + "=true");
|
||||
|
||||
// pass along any pass-through arguments
|
||||
for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
|
||||
String key = (String)entry.getKey();
|
||||
@@ -806,8 +809,7 @@ public class Application
|
||||
|
||||
|
||||
String[] envp = createEnvironment();
|
||||
String[] sargs = new String[args.size()];
|
||||
args.toArray(sargs);
|
||||
String[] sargs = args.toArray(new String[args.size()]);
|
||||
log.info("Running " + StringUtil.join(sargs, "\n "));
|
||||
|
||||
return Runtime.getRuntime().exec(sargs, envp);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// $Id$
|
||||
// Getdown - application installer, patcher and launcher
|
||||
// Copyright (C) 2004-2010 Three Rings Design, Inc.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
// provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
// conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
package com.threerings.getdown.data;
|
||||
|
||||
/**
|
||||
* System property constants associated with Getdown.
|
||||
*/
|
||||
public class Properties
|
||||
{
|
||||
/** This property will be set to "true" on the application when it is being run by getdown. */
|
||||
public static final String GETDOWN = "com.threerings.getdown";
|
||||
}
|
||||
Reference in New Issue
Block a user