mirror of
https://github.com/JHUAPL/DistMaker.git
synced 2026-01-10 06:58:06 -05:00
Various updates
This commit is contained in:
BIN
lib/glum.jar
BIN
lib/glum.jar
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
package distMaker;
|
||||
|
||||
import glum.gui.panel.generic.MessagePanel;
|
||||
import glum.gui.panel.generic.PromptPanel;
|
||||
import glum.gui.panel.task.FullTaskPanel;
|
||||
import glum.io.IoUtil;
|
||||
import glum.net.Credential;
|
||||
@@ -28,6 +29,7 @@ public class DistMakerEngine
|
||||
// Gui vars
|
||||
private JFrame parentFrame;
|
||||
private MessagePanel msgPanel;
|
||||
private PromptPanel promptPanel;
|
||||
private PickReleasePanel pickVersionPanel;
|
||||
|
||||
public DistMakerEngine(JFrame aParentFrame, URL aUpdateUrl)
|
||||
@@ -39,6 +41,8 @@ public class DistMakerEngine
|
||||
parentFrame = aParentFrame;
|
||||
msgPanel = new MessagePanel(parentFrame);
|
||||
msgPanel.setSize(375, 180);
|
||||
promptPanel = new PromptPanel(parentFrame);
|
||||
promptPanel.setSize(300, 150);
|
||||
|
||||
initialize();
|
||||
}
|
||||
@@ -63,11 +67,11 @@ public class DistMakerEngine
|
||||
}
|
||||
appName = currRelease.getName();
|
||||
|
||||
// Determine the destination where to drop the release
|
||||
// Determine the installation path and ensure the entire tree is writable
|
||||
installPath = DistUtils.getAppPath().getParentFile();
|
||||
if (installPath.setWritable(true) == false)
|
||||
if (DistUtils.isFullyWriteable(installPath) == false)
|
||||
{
|
||||
infoMsg = "The install path, " + installPath + ", is not writable.\n";
|
||||
infoMsg = "The install tree, " + installPath + ", is not completely writable.\n";
|
||||
infoMsg += "Please run as the proper user or ensure you are running via writeable media.";
|
||||
displayNotice(infoMsg);
|
||||
return;
|
||||
@@ -198,11 +202,11 @@ public class DistMakerEngine
|
||||
* This method will be called via reflection.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private void checkForUpdatesWorker(Task aTask)
|
||||
private void checkForUpdatesWorker(final Task aTask)
|
||||
{
|
||||
List<Release> fullList;
|
||||
final List<Release> fullList;
|
||||
Release chosenItem;
|
||||
File installPath, destPath;
|
||||
final File installPath, destPath;
|
||||
String appName;
|
||||
boolean isPass;
|
||||
|
||||
@@ -225,7 +229,6 @@ public class DistMakerEngine
|
||||
|
||||
// Prompt the user for the Release
|
||||
aTask.infoAppendln("Please select the release to install...");
|
||||
pickVersionPanel.setConfiguration(fullList);
|
||||
try
|
||||
{
|
||||
SwingUtilities.invokeAndWait(new Runnable()
|
||||
@@ -233,6 +236,23 @@ public class DistMakerEngine
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// Query the user, if the wish to destroy the old update
|
||||
if (destPath.isDirectory() == true)
|
||||
{
|
||||
promptPanel.setTitle("Overwrite recent update?");
|
||||
promptPanel.setInfo("An update has already been downloaded... If you proceed this update will be removed. Proceed?");
|
||||
promptPanel.setVisibleAsModal();
|
||||
if (promptPanel.isAccepted() == false)
|
||||
{
|
||||
aTask.abort();
|
||||
return;
|
||||
}
|
||||
|
||||
IoUtil.deleteDirectory(destPath);
|
||||
}
|
||||
|
||||
// Query the user of the version to update to
|
||||
pickVersionPanel.setConfiguration(fullList);
|
||||
pickVersionPanel.setVisibleAsModal();
|
||||
}
|
||||
});
|
||||
@@ -359,7 +379,7 @@ public class DistMakerEngine
|
||||
return;
|
||||
}
|
||||
// Update passed
|
||||
else if (DistUtils.getUpdateCode() == 1)
|
||||
else if (updateCode == 1)
|
||||
{
|
||||
msg = "The application, " + currRelease.getName() + ", has been updated to ";
|
||||
msg += "version: " + currRelease.getVersion();
|
||||
|
||||
@@ -15,11 +15,10 @@ import com.google.common.collect.Lists;
|
||||
|
||||
public class DistUtils
|
||||
{
|
||||
// Static members that will be automatically updated by the AppLaunch
|
||||
// Static member to declare the update status, 0: None, 1: Pass, 2: Fail
|
||||
// This field will be automatically updated by the AppLauncher
|
||||
// Static members that may be automatically updated by the AppLauncher class loader.
|
||||
// Do not rename or change these variables, without changing the AppLauncher class loader.
|
||||
private static boolean isDevelopersEnvironment = true;
|
||||
private static int updateCode = 0;
|
||||
private static int updateCode = 0; // Static member to declare the update status, 0: None, 1: Pass, 2: Fail
|
||||
private static String updateMsg = null;
|
||||
|
||||
/**
|
||||
@@ -46,7 +45,7 @@ public class DistUtils
|
||||
return currPath;
|
||||
}
|
||||
|
||||
// Return default location
|
||||
// Return default (grandparent to jar) location
|
||||
return jarPath.getParentFile().getParentFile();
|
||||
}
|
||||
|
||||
@@ -330,19 +329,44 @@ public class DistUtils
|
||||
break;
|
||||
|
||||
case Interrupted:
|
||||
errMsg += "The retrival of the remote file, releaseInfo.txt, has been interrupted.";
|
||||
errMsg += "The retrival of the remote file, " + remoteFileName + ", has been interrupted.";
|
||||
break;
|
||||
|
||||
case InvalidResource:
|
||||
errMsg += "The remote file, releaseInfo.txt, does not appear to be valid.";
|
||||
errMsg += "The remote file, " + remoteFileName + ", does not appear to be valid.";
|
||||
break;
|
||||
|
||||
default:
|
||||
errMsg += "An undefined error occurred while retrieving the remote file, releaseInfo.txt.";
|
||||
errMsg += "An undefined error occurred while retrieving the remote file, " + remoteFileName + ".";
|
||||
break;
|
||||
}
|
||||
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to determine if the specified path is fully writable by this process. This is done by making sure
|
||||
* that all folders and child folders are writable by the current process. Note after this method is called, all
|
||||
* folders will have the write permission bit set.
|
||||
*/
|
||||
public static boolean isFullyWriteable(File aPath)
|
||||
{
|
||||
if (aPath.isDirectory() == false)
|
||||
throw new RuntimeException("Specified path is not a folder: " + aPath);
|
||||
|
||||
// Change the reference path to be writable
|
||||
if (aPath.setWritable(true) == false)
|
||||
return false;
|
||||
|
||||
// Recurse on all child folders
|
||||
for (File aFile : aPath.listFiles())
|
||||
{
|
||||
// Check the child folder (recursively)
|
||||
if (aFile.isDirectory() == true && isFullyWriteable(aFile) == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user