mUiName = uiName;\r
}\r
\r
- @Override\r
- public String toString() {\r
+ /** Returns the UI name of the OS. */\r
+ public String getUiName() {\r
return mUiName;\r
}\r
\r
*/\r
public static Os getCurrentOs() {\r
String os = System.getProperty("os.name"); //$NON-NLS-1$\r
- if (os.startsWith("Mac OS")) { //$NON-NLS-1$\r
+ if (os.startsWith("Mac")) { //$NON-NLS-1$\r
return Os.MACOSX;\r
\r
} else if (os.startsWith("Windows")) { //$NON-NLS-1$\r
mUiName = uiName;\r
}\r
\r
- @Override\r
- public String toString() {\r
+ /** Returns the UI name of the architecture. */\r
+ public String getUiName() {\r
return mUiName;\r
}\r
\r
}\r
\r
/**\r
- * Generates a short description for this archive.\r
+ * Generates a description for this archive of the OS/Arch supported by this archive.\r
*/\r
- public String getShortDescription() {\r
+ public String getOsDescription() {\r
String os;\r
if (mOs == null) {\r
os = "unknown OS";\r
} else if (mOs == Os.ANY) {\r
os = "any OS";\r
} else {\r
- os = mOs.toString();\r
+ os = mOs.getUiName();\r
}\r
\r
- String arch = "";\r
+ String arch = ""; //$NON-NLS-1$\r
if (mArch != null && mArch != Arch.ANY) {\r
- arch = mArch.toString();\r
+ arch = mArch.getUiName();\r
}\r
\r
- return String.format("Archive for %1$s %2$s", os, arch);\r
+ return String.format("%1$s%2$s%3$s",\r
+ os,\r
+ arch.length() > 0 ? " " : "", //$NON-NLS-2$\r
+ arch);\r
+ }\r
+\r
+ /**\r
+ * Generates a short description for this archive.\r
+ */\r
+ public String getShortDescription() {\r
+ return String.format("Archive for %1$s", getOsDescription());\r
}\r
\r
/**\r
\r
// TODO: we should not see this test fail if we had the filter UI above.\r
if (!isCompatible()) {\r
- monitor.setResult("Skipping incompatible archive: %1$s", name);\r
+ monitor.setResult("Skipping incompatible archive: %1$s for %2$s",\r
+ name,\r
+ getOsDescription());\r
return false;\r
}\r
\r
// implementations can be expected to do that.\r
name = name.replace('\\', '/');\r
\r
+ // Zip entries are always packages in a top-level directory\r
+ // (e.g. docs/index.html). However we want to use our top-level\r
+ // directory so we drop the first segment of the path name.\r
+ int pos = name.indexOf('/');\r
+ if (pos < 0 || pos == name.length() - 1) {\r
+ continue;\r
+ } else {\r
+ name = name.substring(pos + 1);\r
+ }\r
+\r
File destFile = new File(unzipDestFolder, name);\r
\r
if (name.endsWith("/")) { //$NON-NLS-1$\r