comparison dwt/browser/AppFileLocProvider.d @ 333:8235a17d9255

Continued progress on Mozilla.d
author John Reimer <terminal.node@gmail.com>
date Sun, 19 Oct 2008 21:18:43 -0700
parents c7c696cdfec2
children 3f4a5c7d138f
comparison
equal deleted inserted replaced
332:9e715c0a8376 333:8235a17d9255
43 static final String PLUGINS_DIR = "plugins"; //$NON-NLS-1$ 43 static final String PLUGINS_DIR = "plugins"; //$NON-NLS-1$
44 static final String USER_PLUGINS_DIR = ".mozilla" ~ SEPARATOR_OS ~ "plugins"; //$NON-NLS-1$ //$NON-NLS-2$ 44 static final String USER_PLUGINS_DIR = ".mozilla" ~ SEPARATOR_OS ~ "plugins"; //$NON-NLS-1$ //$NON-NLS-2$
45 static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$ 45 static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$
46 46
47 this (String path) { 47 this (String path) {
48 mozillaPath = path ~ SEPARATOR_OS;f 48 mozillaPath = path ~ SEPARATOR_OS;
49 } 49 }
50 50
51 int AddRef () { 51 nsrefcnt AddRef () {
52 refCount++; 52 refCount++;
53 return refCount; 53 return refCount;
54 } 54 }
55 55
56 int QueryInterface (nsID* riid, int void** ppvObject) { 56 nsresult QueryInterface (nsID* riid, int void** ppvObject) {
57 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; 57 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
58 58
59 if (*riid == nsISupports.IID)) { 59 if (*riid == nsISupports.IID)) {
60 *ppvObject = cast(void*)cast(nsISupports)this; 60 *ppvObject = cast(void*)cast(nsISupports)this;
61 AddRef (); 61 AddRef ();
74 74
75 *ppvObject = null; 75 *ppvObject = null;
76 return XPCOM.NS_ERROR_NO_INTERFACE; 76 return XPCOM.NS_ERROR_NO_INTERFACE;
77 } 77 }
78 78
79 int Release () { 79 nsrefcnt Release () {
80 refCount--; 80 refCount--;
81 if (refCount is 0) return 0; 81 if (refCount is 0) return 0;
82 return refCount; 82 return refCount;
83 } 83 }
84 84
141 if (rc !is XPCOM.NS_ERROR_FILE_UNRECOGNIZED_PATH) { 141 if (rc !is XPCOM.NS_ERROR_FILE_UNRECOGNIZED_PATH) {
142 /* value appears to be a valid pathname */ 142 /* value appears to be a valid pathname */
143 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); 143 if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
144 if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); 144 if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
145 145
146 rc = localFile.QueryInterface (nsIFile.NS_IFILE_IID, &(cast(void*)file)); 146 rc = localFile.QueryInterface (nsIFile.NS_IFILE_IID, cast(void**)&file);
147 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); 147 if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
148 if (file is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); 148 if (file is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
149 localFile.Release (); 149 localFile.Release ();
150 150
151 files[index++] = cast(nsISupports)file; 151 files[index++] = cast(nsISupports)file;
228 int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &(cast(void*)localFile)); 228 int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &(cast(void*)localFile));
229 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); 229 if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
230 if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); 230 if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
231 231
232 nsIFile file; 232 nsIFile file;
233 rc = localFile.QueryInterface (nsIFile.IID, &(cast(void*)file)); 233 rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&file));
234 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); 234 if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
235 if (file is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); 235 if (file is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
236 236
237 *_retval = file; 237 *_retval = file;
238 localFile.Release (); 238 localFile.Release ();