Minor reorg & fix all "config UI when getdown.txt" changes issues.
This commit is contained in:
@@ -510,7 +510,7 @@ public class Application
|
||||
* discovered later, the caller can use the application base to download a new {@code
|
||||
* getdown.txt} file and try again.
|
||||
*
|
||||
* @return a configured Config instance that contains information from the config file.
|
||||
* @return a {@code Config} instance that contains information from the config file.
|
||||
*
|
||||
* @exception IOException thrown if there is an error reading the file or an error encountered
|
||||
* during its parsing.
|
||||
@@ -672,7 +672,7 @@ public class Application
|
||||
parseResources(config, "resource", Resource.NORMAL, _resources);
|
||||
parseResources(config, "uresource", Resource.UNPACK, _resources);
|
||||
parseResources(config, "xresource", Resource.EXEC, _resources);
|
||||
parseResources(config, "presource", Resource.PREDOWNLOAD, _resources);
|
||||
parseResources(config, "presource", Resource.PRELOAD, _resources);
|
||||
|
||||
// parse our auxiliary resource groups
|
||||
for (String auxgroup : config.getList("auxgroups")) {
|
||||
@@ -721,26 +721,13 @@ public class Application
|
||||
_maxConcDownloads = Math.max(1, config.getInt("max_concurrent_downloads",
|
||||
SysProps.threadPoolSize()));
|
||||
|
||||
// extract some info used to configure our child process on macOS
|
||||
_dockName = config.getString("ui.name");
|
||||
_dockIconPath = config.getString("ui.mac_dock_icon", "../desktop.icns");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets various properties using an UpdateInterface based on {@code config}
|
||||
* @param config Information to base the UpdateInterface off
|
||||
* @return a configured UpdateInterface instance that will be used to configure the update UI
|
||||
*/
|
||||
public UpdateInterface initUpdateInterface(Config config) {
|
||||
// parse and return our application config
|
||||
UpdateInterface ui = new UpdateInterface(config);
|
||||
_name = ui.name;
|
||||
_dockIconPath = config.getString("ui.mac_dock_icon");
|
||||
if (_dockIconPath == null) {
|
||||
_dockIconPath = "../desktop.icns"; // use a sensible default
|
||||
}
|
||||
|
||||
return ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds strings of the form pair0=pair1 to collector for each pair parsed out of pairLocation.
|
||||
*/
|
||||
@@ -936,7 +923,7 @@ public class Application
|
||||
// we love our Mac users, so we do nice things to preserve our application identity
|
||||
if (LaunchUtil.isMacOS()) {
|
||||
args.add("-Xdock:icon=" + getLocalPath(_dockIconPath).getAbsolutePath());
|
||||
args.add("-Xdock:name=" + _name);
|
||||
args.add("-Xdock:name=" + _dockName);
|
||||
}
|
||||
|
||||
// pass along our proxy settings
|
||||
@@ -1179,7 +1166,7 @@ public class Application
|
||||
clearValidationMarkers();
|
||||
// if the new copy validates, reinitialize ourselves; otherwise report baffling hoseage
|
||||
if (_digest.validateResource(crsrc, null)) {
|
||||
initUpdateInterface(init(true));
|
||||
init(true);
|
||||
} else {
|
||||
log.warning(CONFIG_FILE + " failed to validate even after redownloading. " +
|
||||
"Blindly forging onward.");
|
||||
@@ -1713,7 +1700,7 @@ public class Application
|
||||
protected URL _vappbase;
|
||||
protected URL _latest;
|
||||
protected String _class;
|
||||
protected String _name;
|
||||
protected String _dockName;
|
||||
protected String _dockIconPath;
|
||||
protected boolean _strictComments;
|
||||
protected boolean _windebug;
|
||||
|
||||
@@ -37,13 +37,13 @@ public class Resource implements Comparable<Resource>
|
||||
/** Indicates that the resource should be marked executable. */
|
||||
EXEC,
|
||||
/** Indicates that the resource should be downloaded before a UI is displayed. */
|
||||
PREDOWNLOAD
|
||||
PRELOAD
|
||||
};
|
||||
|
||||
public static final EnumSet<Attr> NORMAL = EnumSet.noneOf(Attr.class);
|
||||
public static final EnumSet<Attr> UNPACK = EnumSet.of(Attr.UNPACK);
|
||||
public static final EnumSet<Attr> EXEC = EnumSet.of(Attr.EXEC);
|
||||
public static final EnumSet<Attr> PREDOWNLOAD = EnumSet.of(Attr.PREDOWNLOAD);
|
||||
public static final EnumSet<Attr> NORMAL = EnumSet.noneOf(Attr.class);
|
||||
public static final EnumSet<Attr> UNPACK = EnumSet.of(Attr.UNPACK);
|
||||
public static final EnumSet<Attr> EXEC = EnumSet.of(Attr.EXEC);
|
||||
public static final EnumSet<Attr> PRELOAD = EnumSet.of(Attr.PRELOAD);
|
||||
|
||||
/**
|
||||
* Computes the MD5 hash of the supplied file.
|
||||
@@ -205,11 +205,11 @@ public class Resource implements Comparable<Resource>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this resource should be predownloaded.
|
||||
* Returns true if this resource should be pre-downloaded.
|
||||
*/
|
||||
public boolean shouldPredownload ()
|
||||
{
|
||||
return _attrs.contains(Attr.PREDOWNLOAD);
|
||||
return _attrs.contains(Attr.PRELOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,7 +267,7 @@ public class Resource implements Comparable<Resource>
|
||||
|
||||
/**
|
||||
* Installs the {@code getLocalNew} version of this resource to {@code getLocal}.
|
||||
* @param validate Validate resource after installing?
|
||||
* @param validate whether or not to mark the resource as valid after installing.
|
||||
*/
|
||||
public void install (boolean validate) throws IOException {
|
||||
File source = getLocalNew(), dest = getLocal();
|
||||
@@ -276,19 +276,11 @@ public class Resource implements Comparable<Resource>
|
||||
throw new IOException("Failed to rename " + source + " to " + dest);
|
||||
}
|
||||
applyAttrs();
|
||||
|
||||
if (validate){
|
||||
if (validate) {
|
||||
markAsValid();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as calling {@link #install(boolean)} with {@code true}
|
||||
*/
|
||||
public void install () throws IOException {
|
||||
install(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks this resource file into the directory that contains it.
|
||||
*/
|
||||
|
||||
@@ -60,13 +60,13 @@ public class Differ
|
||||
}
|
||||
|
||||
Application oapp = new Application(new EnvConfig(ovdir));
|
||||
oapp.initUpdateInterface(oapp.init(false));
|
||||
oapp.init(false);
|
||||
ArrayList<Resource> orsrcs = new ArrayList<>();
|
||||
orsrcs.addAll(oapp.getCodeResources());
|
||||
orsrcs.addAll(oapp.getResources());
|
||||
|
||||
Application napp = new Application(new EnvConfig(nvdir));
|
||||
napp.initUpdateInterface(napp.init(false));
|
||||
napp.init(false);
|
||||
ArrayList<Resource> nrsrcs = new ArrayList<>();
|
||||
nrsrcs.addAll(napp.getCodeResources());
|
||||
nrsrcs.addAll(napp.getResources());
|
||||
|
||||
@@ -75,7 +75,7 @@ public class Digester
|
||||
|
||||
// create our application and instruct it to parse its business
|
||||
Application app = new Application(new EnvConfig(appdir));
|
||||
app.initUpdateInterface(app.init(false));
|
||||
app.init(false);
|
||||
|
||||
List<Resource> rsrcs = new ArrayList<>();
|
||||
rsrcs.add(app.getConfigResource());
|
||||
|
||||
Reference in New Issue
Block a user