Mercurial > projects > dwt2
comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/AppFileLocProvider.d @ 54:70388b0e6dad
[swt lin] compiles
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 27 Mar 2009 23:31:11 +0100 |
parents | 7e78af7adab5 |
children | ea8b884d85f6 |
comparison
equal
deleted
inserted
replaced
53:7e78af7adab5 | 54:70388b0e6dad |
---|---|
17 import tango.text.Util; | 17 import tango.text.Util; |
18 } else { // Phobos | 18 } else { // Phobos |
19 } | 19 } |
20 | 20 |
21 import java.lang.all; | 21 import java.lang.all; |
22 import java.util.Vector; | |
23 | |
22 import org.eclipse.swt.browser.Mozilla; | 24 import org.eclipse.swt.browser.Mozilla; |
23 import org.eclipse.swt.browser.SimpleEnumerator; | 25 import org.eclipse.swt.browser.SimpleEnumerator; |
24 | 26 |
25 import org.eclipse.swt.internal.Compatibility; | 27 import org.eclipse.swt.internal.Compatibility; |
26 | 28 |
66 refCount++; | 68 refCount++; |
67 return refCount; | 69 return refCount; |
68 } | 70 } |
69 | 71 |
70 extern(System) | 72 extern(System) |
71 nsresult QueryInterface (cnsID* riid, void** ppvObject) { | 73 nsresult QueryInterface (in cnsID* riid, void** ppvObject) { |
72 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; | 74 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; |
73 | 75 |
74 if (*riid == nsISupports.IID) { | 76 if (*riid == nsISupports.IID) { |
75 *ppvObject = cast(void*)cast(nsISupports)this; | 77 *ppvObject = cast(void*)cast(nsISupports)this; |
76 AddRef (); | 78 AddRef (); |
114 } | 116 } |
115 | 117 |
116 /* nsIDirectoryServiceProvider2 */ | 118 /* nsIDirectoryServiceProvider2 */ |
117 extern(System) | 119 extern(System) |
118 nsresult GetFiles (char* prop, nsISimpleEnumerator* _retval) { | 120 nsresult GetFiles (char* prop, nsISimpleEnumerator* _retval) { |
119 String propertyName = fromStringz(prop); | 121 String propertyName = fromStringz(prop)._idup(); |
120 String[] propertyValues = null; | 122 String[] propertyValues = null; |
121 | 123 |
122 if (propertyName == XPCOM.NS_APP_PLUGINS_DIR_LIST) { | 124 if (propertyName == XPCOM.NS_APP_PLUGINS_DIR_LIST) { |
123 if (pluginDirs is null) { | 125 if (pluginDirs is null) { |
124 int index = 0; | 126 int index = 0; |
125 /* set the first value(s) to the MOZ_PLUGIN_PATH environment variable value if it's defined */ | 127 /* set the first value(s) to the MOZ_PLUGIN_PATH environment variable value if it's defined */ |
126 String value = Environment.get (XPCOM.MOZILLA_PLUGIN_PATH); | 128 version(Tango){ |
129 String value = Environment.get (XPCOM.MOZILLA_PLUGIN_PATH); | |
130 } else { // Phobos | |
131 implMissing(__FILE__, __LINE__); | |
132 String value; | |
133 } | |
127 if (value !is null) { | 134 if (value !is null) { |
128 if (value.length > 0) { | 135 if (value.length > 0) { |
129 String separator = System.getProperty ("file.separator"); // $NON-NLS-1$ | 136 String separator = System.getProperty ("path.separator"); // $NON-NLS-1$ |
130 foreach (segment; delimiters(value, separator)) | 137 Vector segments = new Vector (); |
131 pluginDirs ~= segment; | 138 int start, end = -1; |
139 do { | |
140 start = end + 1; | |
141 end = value.indexOf (separator, start); | |
142 String segment; | |
143 if (end is -1) { | |
144 segment = value.substring (start); | |
145 } else { | |
146 segment = value.substring (start, end); | |
147 } | |
148 if (segment.length () > 0) segments.addElement (stringcast(segment)); | |
149 } while (end !is -1); | |
150 int segmentsSize = segments.size (); | |
151 pluginDirs = new String [segmentsSize + 2]; | |
152 for (index = 0; index < segmentsSize; index++) { | |
153 pluginDirs[index] = stringcast(segments.elementAt (index)); | |
154 } | |
132 } | 155 } |
133 } | 156 } |
134 if (pluginDirs is null) { | 157 if (pluginDirs is null) { |
135 pluginDirs = new String[2]; | 158 pluginDirs = new String[2]; |
136 } | 159 } |
137 | 160 |
138 /* set the next value to the GRE path + "plugins" */ | 161 /* set the next value to the GRE path + "plugins" */ |
139 pluginDirs ~= mozillaPath ~ PLUGINS_DIR; | 162 pluginDirs[ index++ ] = mozillaPath ~ PLUGINS_DIR; |
140 | 163 |
141 /* set the next value to the home directory + "/.mozilla/plugins" */ | 164 /* set the next value to the home directory + "/.mozilla/plugins" */ |
142 pluginDirs ~= System.getProperty("user.home") ~ SEPARATOR_OS ~ USER_PLUGINS_DIR; | 165 pluginDirs[ index++ ] = System.getProperty("user.home") ~ SEPARATOR_OS ~ USER_PLUGINS_DIR; |
143 } | 166 } |
144 propertyValues = pluginDirs; | 167 propertyValues = pluginDirs; |
145 } | 168 } |
146 | 169 |
147 *_retval = null; | 170 *_retval = null; |
183 } | 206 } |
184 | 207 |
185 /* nsIDirectoryServiceProvider implementation */ | 208 /* nsIDirectoryServiceProvider implementation */ |
186 extern(System) | 209 extern(System) |
187 nsresult GetFile(char* prop, PRBool* persistent, nsIFile* _retval) { | 210 nsresult GetFile(char* prop, PRBool* persistent, nsIFile* _retval) { |
188 String propertyName = tango.stdc.stringz.fromStringz( prop ); | 211 String propertyName = fromStringz( prop )._idup(); |
189 String propertyValue = null; | 212 String propertyValue = null; |
190 | 213 |
191 if (propertyName == (XPCOM.NS_APP_HISTORY_50_FILE)) { | 214 if (propertyName == (XPCOM.NS_APP_HISTORY_50_FILE)) { |
192 propertyValue = profilePath ~ HISTORY_FILE; | 215 propertyValue = profilePath ~ HISTORY_FILE; |
193 } else if (propertyName == (XPCOM.NS_APP_USER_MIMETYPES_50_FILE)) { | 216 } else if (propertyName == (XPCOM.NS_APP_USER_MIMETYPES_50_FILE)) { |