Blob Blame Raw
### Eclipse Workspace Patch 1.0
#P org.eclipse.swt
Index: Eclipse_SWT_Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse_SWT_Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java,v
retrieving revision 1.10
diff -u -r1.10 AppFileLocProvider.java
--- Eclipse_SWT_Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java	23 Aug 2007 17:10:46 -0000	1.10
+++ Eclipse_SWT_Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java	14 May 2008 18:08:48 -0000
@@ -12,7 +12,7 @@
 
 import java.util.Vector;
 
-import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.mozilla.*;
 
 class AppFileLocProvider {
@@ -119,6 +119,19 @@
 
 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 */
Index: Eclipse_SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse_SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java,v
retrieving revision 1.28
diff -u -r1.28 Compatibility.java
--- Eclipse_SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java	10 Oct 2007 18:36:05 -0000	1.28
+++ Eclipse_SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java	14 May 2008 18:08:48 -0000
@@ -99,6 +99,17 @@
 }
 
 /**
+ * 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.