Show
Ignore:
Timestamp:
09/07/08 19:43:08 (4 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Sync with dwt-linux

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/dwthelper/System.d

    r280 r305  
    66import dwt.dwthelper.utils; 
    77 
     8import tango.sys.Environment; 
    89import tango.core.Exception; 
     10import tango.io.model.IFile : FileConst; 
    911import tango.time.Clock; 
    1012import tango.stdc.stdlib : exit; 
     
    145147    } 
    146148 
     149    public static String getProperty( String key, String defval ){ 
     150        String res = getProperty(key); 
     151        if( res ){ 
     152            return res; 
     153        } 
     154        return defval; 
     155    } 
    147156    public static String getProperty( String key ){ 
    148         switch( key ){ 
    149         case "os.name": return "linux"; 
    150         case "file.separator" : return "."; 
    151         default: return null; 
    152         } 
    153     } 
     157        /* Get values for local dwt specific keys */ 
     158        String* p; 
     159        if (key[0..3] == "dwt") { 
     160            return ((p = key in localProperties) != null) ? *p : null; 
     161        /* else get values for global system keys (environment) */ 
     162        } else { 
     163            switch( key ){ 
     164                case "os.name": return "linux"; 
     165                case "user.name": return ""; 
     166                case "user.home": return ""; 
     167                case "user.dir" : return ""; 
     168                case "file.separator" : return FileConst.PathSeparatorString ; 
     169                default: return null; 
     170            } 
     171        } 
     172    } 
     173 
     174    public static void setProperty ( String key, String value ) { 
     175        /* set property for local dwt keys */ 
     176        if (key[0..3] == "dwt") { 
     177            if (key !is null && value !is null) 
     178                localProperties[ key ] = value; 
     179        /* else set properties for global system keys (environment) */ 
     180        } else { 
     181 
     182        } 
     183 
     184    } 
     185 
     186    static class Output { 
     187        public void println( String str ){ 
     188            implMissing( __FILE__, __LINE__ ); 
     189        } 
     190    } 
     191 
     192    private static Output err__; 
     193    public static Output err(){ 
     194        if( err__ is null ){ 
     195            err__ = new Output(); 
     196        } 
     197        return err__; 
     198    } 
     199    private static Output out__; 
     200    public static Output out_(){ 
     201        if( out__ is null ){ 
     202            out__ = new Output(); 
     203        } 
     204        return out__; 
     205    } 
     206 
     207    private static String[String] localProperties; 
    154208} 
    155209