comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d @ 39:0ecb2b338560

further work on phobosification
author Frank Benoit <benoit@tionex.de>
date Wed, 25 Mar 2009 13:20:43 +0100
parents b7a1d02a0e1f
children 536e43f63c81
comparison
equal deleted inserted replaced
38:2e09b0e6857a 39:0ecb2b338560
119 * @param parent the file's parent directory 119 * @param parent the file's parent directory
120 * @param child the file's name 120 * @param child the file's name
121 * @return true if the file exists 121 * @return true if the file exists
122 */ 122 */
123 public static bool fileExists(String parent, String child) { 123 public static bool fileExists(String parent, String child) {
124 return tango.io.Path.exists( 124 version(Tango){
125 tango.io.Path.join( 125 return tango.io.Path.exists(
126 tango.io.Path.standard(parent), 126 tango.io.Path.join(
127 tango.io.Path.standard(child))); 127 tango.io.Path.standard(parent),
128 tango.io.Path.standard(child)));
129 } else { // Phobos
130 implMissing( __FILE__, __LINE__ );
131 return false;
132 }
128 } 133 }
129 134
130 /** 135 /**
131 * Answers the most positive (i.e. closest to positive infinity) 136 * Answers the most positive (i.e. closest to positive infinity)
132 * integer value which is less than the number obtained by dividing 137 * integer value which is less than the number obtained by dividing
278 * 283 *
279 * @exception ProcessException 284 * @exception ProcessException
280 * if the program cannot be executed 285 * if the program cannot be executed
281 */ 286 */
282 public static void exec(String prog) { 287 public static void exec(String prog) {
283 auto proc = new tango.sys.Process.Process( prog ); 288 version(Tango){
284 proc.execute; 289 auto proc = new tango.sys.Process.Process( prog );
290 proc.execute;
291 } else { // Phobos
292 implMissing( __FILE__, __LINE__ );
293 }
285 } 294 }
286 295
287 /** 296 /**
288 * Execute progArray[0] in a separate platform process if the 297 * Execute progArray[0] in a separate platform process if the
289 * underlying platform support this. 298 * underlying platform support this.
295 * 304 *
296 * @exception ProcessException 305 * @exception ProcessException
297 * if the program cannot be executed 306 * if the program cannot be executed
298 */ 307 */
299 public static void exec(String[] progArray) { 308 public static void exec(String[] progArray) {
300 auto proc = new tango.sys.Process.Process( progArray ); 309 version(Tango){
301 proc.execute; 310 auto proc = new tango.sys.Process.Process( progArray );
311 proc.execute;
312 } else { // Phobos
313 implMissing( __FILE__, __LINE__ );
314 }
302 } 315 }
303 316
304 const ImportData[] SWTMessagesBundleData = [ 317 const ImportData[] SWTMessagesBundleData = [
305 getImportData!( "org.eclipse.swt.internal.SWTMessages.properties" ), 318 getImportData!( "org.eclipse.swt.internal.SWTMessages.properties" ),
306 getImportData!( "org.eclipse.swt.internal.SWTMessages_ar.properties" ), 319 getImportData!( "org.eclipse.swt.internal.SWTMessages_ar.properties" ),
374 answer = key ~ " (no resource bundle)"; //$NON-NLS-1$ 387 answer = key ~ " (no resource bundle)"; //$NON-NLS-1$
375 } 388 }
376 } 389 }
377 if (msgs !is null) { 390 if (msgs !is null) {
378 try { 391 try {
379 char[] frmt = msgs.getString(key); 392 auto frmt = msgs.getString(key);
380 switch( args.length ){ 393 switch( args.length ){
381 case 0: answer = Format(frmt); break; 394 case 0: answer = Format(frmt); break;
382 case 1: answer = Format(frmt, args[0]); break; 395 case 1: answer = Format(frmt, args[0]); break;
383 case 2: answer = Format(frmt, args[0], args[1]); break; 396 case 2: answer = Format(frmt, args[0], args[1]); break;
384 case 3: answer = Format(frmt, args[0], args[1], args[2]); break; 397 case 3: answer = Format(frmt, args[0], args[1], args[2]); break;
411 * @param s1 string 424 * @param s1 string
412 * @param s2 string 425 * @param s2 string
413 * @return true if the two instances of class String are equal 426 * @return true if the two instances of class String are equal
414 */ 427 */
415 public static bool equalsIgnoreCase(String s1, String s2) { 428 public static bool equalsIgnoreCase(String s1, String s2) {
416 String s1b = new char[ s1.length ]; 429 version(Tango){
417 String s2b = new char[ s1.length ]; 430 String s1b = new char[ s1.length ];
418 scope(exit){ 431 String s2b = new char[ s1.length ];
419 delete s1b; 432 scope(exit){
420 delete s2b; 433 delete s1b;
421 } 434 delete s2b;
422 String s1c = tango.text.Unicode.toFold( s1, s1b ); 435 }
423 String s2c = tango.text.Unicode.toFold( s2, s2b ); 436 String s1c = tango.text.Unicode.toFold( s1, s1b );
424 return s1c == s2c; 437 String s2c = tango.text.Unicode.toFold( s2, s2b );
425 } 438 return s1c == s2c;
426 439 } else { // Phobos
427 } 440 implMissing( __FILE__, __LINE__ );
441 return false;
442 }
443 }
444
445 }