diff options
author | Grant Gayed | 2008-08-26 16:22:35 +0000 |
---|---|---|
committer | Grant Gayed | 2008-08-26 16:22:35 +0000 |
commit | a2e90dcb7043cff17fc38f201cac8b609cc4bf0f (patch) | |
tree | 887f68120eefd7a5c23e0d90010a0da33f667eb8 | |
parent | 6fec845f544de55cd044cef8217f87151e1fa431 (diff) | |
download | eclipse.platform.swt-R3_3_1_Bugzilla207744.tar.gz eclipse.platform.swt-R3_3_1_Bugzilla207744.tar.xz eclipse.platform.swt-R3_3_1_Bugzilla207744.zip |
206432R3_3_1_Bugzilla207744
3 files changed, 36 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java index 22d3adce28..8cc0c71cd3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.browser; -import org.eclipse.swt.internal.C; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.mozilla.*; class AppFileLocProvider { @@ -117,6 +117,19 @@ int Release () { void setProfilePath (String path) { profilePath = path; + if (!Compatibility.fileExists (path, "")) { //$NON-NLS-1$ + int /*long*/[] result = new int /*long*/[1]; + nsEmbedString pathString = new nsEmbedString (path); + int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), true, result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); + pathString.dispose (); + + nsILocalFile file = new nsILocalFile (result [0]); + rc = file.Create (nsILocalFile.DIRECTORY_TYPE, 0700); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + file.Release (); + } } /* nsIDirectoryServiceProvider2 */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java index d0f693c963..027e953ad0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java @@ -285,6 +285,17 @@ public static void exec(String prog) throws java.io.IOException { } /** + * Answers whether the indicated file exists or not. + * + * @param parent the file's parent directory + * @param child the file's name + * @return true if the file exists + */ +public static boolean fileExists(String parent, String child) { + return false; +} + +/** * Execute progArray[0] in a separate platform process if the * underlying platform support this. * <p> diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java index 455292dea3..680ffb0096 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java @@ -98,6 +98,17 @@ public static int ceil(int p, int q) { } /** + * Answers whether the indicated file exists or not. + * + * @param parent the file's parent directory + * @param child the file's name + * @return true if the file exists + */ +public static boolean fileExists(String parent, String child) { + return new File (parent, child).exists(); +} + +/** * Answers the most positive (i.e. closest to positive infinity) * integer value which is less than the number obtained by dividing * the first argument p by the second argument q. |