comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/Compatibility.d @ 54:70388b0e6dad

[swt lin] compiles
author Frank Benoit <benoit@tionex.de>
date Fri, 27 Mar 2009 23:31:11 +0100
parents c01d033c633a
children 536e43f63c81
comparison
equal deleted inserted replaced
53:7e78af7adab5 54:70388b0e6dad
115 * 115 *
116 * @param parent the file's parent directory 116 * @param parent the file's parent directory
117 * @param child the file's name 117 * @param child the file's name
118 * @return true if the file exists 118 * @return true if the file exists
119 */ 119 */
120 public static bool fileExists(String parent, String child) { 120 public static bool fileExists(CString parent, CString child) {
121 return (new File (parent, child)).exists(); 121 return (new File (parent, child)).exists();
122 } 122 }
123 123
124 /** 124 /**
125 * Answers the most positive (i.e. closest to positive infinity) 125 * Answers the most positive (i.e. closest to positive infinity)
190 * 190 *
191 * @param filename the name of the file to open 191 * @param filename the name of the file to open
192 * @return a stream on the file if it could be opened. 192 * @return a stream on the file if it could be opened.
193 * @exception IOException 193 * @exception IOException
194 */ 194 */
195 public static InputStream newFileInputStream(String filename) { 195 public static InputStream newFileInputStream(CString filename) {
196 return new FileInputStream(filename); 196 return new FileInputStream(filename._idup());
197 } 197 }
198 198
199 /** 199 /**
200 * Open a file if such things are supported. 200 * Open a file if such things are supported.
201 * 201 *
202 * @param filename the name of the file to open 202 * @param filename the name of the file to open
203 * @return a stream on the file if it could be opened. 203 * @return a stream on the file if it could be opened.
204 * @exception IOException 204 * @exception IOException
205 */ 205 */
206 public static OutputStream newFileOutputStream(String filename) { 206 public static OutputStream newFileOutputStream(CString filename) {
207 return new FileOutputStream(filename); 207 return new FileOutputStream(filename._idup());
208 } 208 }
209 209
210 /** 210 /**
211 * Create an InflaterInputStream if such things are supported. 211 * Create an InflaterInputStream if such things are supported.
212 * 212 *
270 * @param prog the name of the program to execute 270 * @param prog the name of the program to execute
271 * 271 *
272 * @exception ProcessException 272 * @exception ProcessException
273 * if the program cannot be executed 273 * if the program cannot be executed
274 */ 274 */
275 public static void exec(String prog) { 275 public static void exec(CString prog) {
276 version(Tango){ 276 version(Tango){
277 auto proc = new Process( prog ); 277 auto proc = new Process( prog );
278 proc.execute; 278 proc.execute;
279 } else { // Phobos 279 } else { // Phobos
280 implMissing( __FILE__, __LINE__ ); 280 implMissing( __FILE__, __LINE__ );
291 * @param progArray array containing the program to execute and its arguments 291 * @param progArray array containing the program to execute and its arguments
292 * 292 *
293 * @exception ProcessException 293 * @exception ProcessException
294 * if the program cannot be executed 294 * if the program cannot be executed
295 */ 295 */
296 public static void exec(String[] progArray) { 296 public static void exec(CString[] progArray) {
297 version(Tango){ 297 version(Tango){
298 auto proc = new Process( progArray ); 298 auto proc = new Process( progArray );
299 proc.execute; 299 proc.execute;
300 } else { // Phobos 300 } else { // Phobos
301 implMissing( __FILE__, __LINE__ ); 301 implMissing( __FILE__, __LINE__ );
339 * @param key the key to look up 339 * @param key the key to look up
340 * @return the message for the given key 340 * @return the message for the given key
341 * 341 *
342 * @see SWT#getMessage(String) 342 * @see SWT#getMessage(String)
343 */ 343 */
344 public static String getMessage(String key) { 344 public static String getMessage(CString key) {
345 String answer = key; 345 String answer = key._idup();
346 346
347 if (key is null) { 347 if (key is null) {
348 SWT.error (SWT.ERROR_NULL_ARGUMENT); 348 SWT.error (SWT.ERROR_NULL_ARGUMENT);
349 } 349 }
350 if (msgs is null) { 350 if (msgs is null) {
351 try { 351 try {
352 msgs = ResourceBundle.getBundle(SWTMessagesBundleData); //$NON-NLS-1$ 352 msgs = ResourceBundle.getBundle(SWTMessagesBundleData); //$NON-NLS-1$
353 } catch (MissingResourceException ex) { 353 } catch (MissingResourceException ex) {
354 answer = key ~ " (no resource bundle)"; //$NON-NLS-1$ 354 answer = cast(String)(key ~ " (no resource bundle)"); //$NON-NLS-1$
355 } 355 }
356 } 356 }
357 if (msgs !is null) { 357 if (msgs !is null) {
358 try { 358 try {
359 answer = msgs.getString(key); 359 answer = msgs.getString(key);
360 } catch (MissingResourceException ex2) {} 360 } catch (MissingResourceException ex2) {}
361 } 361 }
362 return answer; 362 return answer;
363 } 363 }
364 364
365 public static String getMessage(String key, Object[] args) { 365 public static String getMessage(CString key, Object[] args) {
366 String answer = key; 366 String answer = key._idup();
367 367
368 if (key is null || args is null) { 368 if (key is null || args is null) {
369 SWT.error (SWT.ERROR_NULL_ARGUMENT); 369 SWT.error (SWT.ERROR_NULL_ARGUMENT);
370 } 370 }
371 if (msgs is null) { 371 if (msgs is null) {
372 try { 372 try {
373 msgs = ResourceBundle.getBundle(SWTMessagesBundleData); //$NON-NLS-1$ 373 msgs = ResourceBundle.getBundle(SWTMessagesBundleData); //$NON-NLS-1$
374 } catch (MissingResourceException ex) { 374 } catch (MissingResourceException ex) {
375 answer = key ~ " (no resource bundle)"; //$NON-NLS-1$ 375 answer = cast(String)(key ~ " (no resource bundle)"); //$NON-NLS-1$
376 } 376 }
377 } 377 }
378 if (msgs !is null) { 378 if (msgs !is null) {
379 try { 379 try {
380 String frmt = msgs.getString(key); 380 String frmt = msgs.getString(key);
411 * 411 *
412 * @param s1 string 412 * @param s1 string
413 * @param s2 string 413 * @param s2 string
414 * @return true if the two instances of class String are equal 414 * @return true if the two instances of class String are equal
415 */ 415 */
416 public static bool equalsIgnoreCase(String s1, String s2) { 416 public static bool equalsIgnoreCase(CString s1, CString s2) {
417 version(Tango){ 417 version(Tango){
418 String s1b = new char[ s1.length ]; 418 String s1b = new char[ s1.length ];
419 String s2b = new char[ s1.length ]; 419 String s2b = new char[ s1.length ];
420 scope(exit){ 420 scope(exit){
421 delete s1b; 421 delete s1b;