summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Schwär2021-02-02 05:27:57 +0100
committerStephan Schwär2021-02-02 05:32:49 +0100
commitf82ffd1f15ddb3bb084a8e8ff92556d467ba183e (patch)
tree41328d2cb6efd5512d285219d948c4849ec70c40
parent[client] Fix some window sizing issues (diff)
downloadtutor-module-f82ffd1f15ddb3bb084a8e8ff92556d467ba183e.tar.gz
tutor-module-f82ffd1f15ddb3bb084a8e8ff92556d467ba183e.tar.xz
tutor-module-f82ffd1f15ddb3bb084a8e8ff92556d467ba183e.zip
[client] Add support for vmwarevm format
Issue #3771
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java14
1 files changed, 14 insertions, 0 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 19ce1429..a23a62ac 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
@@ -6,6 +6,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.util.List;
@@ -126,6 +127,19 @@ public class ImageUploadPage extends ImageUploadPageLayout {
int action = fc.showOpenDialog(getDialog());
File file = fc.getSelectedFile();
+ // If the vm was exported via vmware fusion on macos it might be
+ // a vmwarevm which is a directory containing the vm files within.
+ if (file != null && file.isDirectory()) {
+ File[] vmxfiles = file.listFiles(new FilenameFilter() {
+ public boolean accept(File dir, String filename) {
+ return filename.endsWith(".vmx");
+ }
+ });
+ // There should be only one vmx file in the directory
+ if (vmxfiles[0] != null && vmxfiles[0].isFile())
+ file = vmxfiles[0];
+ }
+
if (action != JFileChooser.APPROVE_OPTION || file == null)
return;
vmSelected(file.getAbsoluteFile());