summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
index aacb0d31..7afeb9c7 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
@@ -38,6 +38,7 @@ import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.dozmod.util.FormatHelper;
import org.openslx.sat.thrift.version.Feature;
import org.openslx.thrifthelper.TConst;
+import org.openslx.util.Util;
import org.openslx.virtualization.configuration.VirtualizationConfigurationVmware;
import org.openslx.virtualization.configuration.data.ConfigurationDataDozModClientToDozModServer;
import org.openslx.virtualization.configuration.logic.ConfigurationLogicDozModClientToDozModServer;
@@ -383,11 +384,18 @@ public class ImageUploadPage extends ImageUploadPageLayout {
setPageComplete(true);
}
+ /**
+ * Check if a lock file exists and ask the user if they want to abort the upload.
+ * @return true if the upload is to be aborted
+ */
private boolean askCancelLockFile(String... lockFiles) {
for (String lockFile : lockFiles) {
+ if (Util.isEmptyString(lockFile))
+ continue;
File file = new File(lockFile);
if (!file.exists())
continue;
+ // Return true if NO was selected. Question is "Continue anyways?"
return !Gui.showMessageBox(this, I18n.PAGE.getString("ImageUpload.Message.yesNo.cancelLockFile"),
MessageType.QUESTION_YESNO, null, null);
}
@@ -410,9 +418,13 @@ public class ImageUploadPage extends ImageUploadPageLayout {
@Override
protected boolean wantNextOrFinish() {
- // Check for vmware player lock files - warn user if found, might corrupt upload
- if (askCancelLockFile(state.descriptionFile.getAbsolutePath() + ".lck",
- state.diskFile.getAbsolutePath() + ".lck")) {
+ // Check for vmware player lock/suspend files - warn user if found, might corrupt upload
+ String suspendedFile = state.virtualizationConfig.getSuspendedFile();
+ if (!Util.isEmptyString(suspendedFile)) {
+ suspendedFile = state.descriptionFile.getParent() + File.separatorChar + suspendedFile;
+ }
+ if (askCancelLockFile(state.descriptionFile.getPath() + ".lck",
+ state.diskFile.getPath() + ".lck", suspendedFile)) {
setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.cancelLockFile"));
return false;
}