diff dwt/dwthelper/System.d @ 305:a401002c3a1f

Sync with dwt-linux
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 01:43:08 +0200
parents 4ec36c3a04a3
children
line wrap: on
line diff
--- a/dwt/dwthelper/System.d	Sat Aug 30 13:59:13 2008 +0200
+++ b/dwt/dwthelper/System.d	Mon Sep 08 01:43:08 2008 +0200
@@ -5,7 +5,9 @@
 
 import dwt.dwthelper.utils;
 
+import tango.sys.Environment;
 import tango.core.Exception;
+import tango.io.model.IFile : FileConst;
 import tango.time.Clock;
 import tango.stdc.stdlib : exit;
 
@@ -144,12 +146,64 @@
         return (*cast(Object *)&x).toHash();
     }
 
+    public static String getProperty( String key, String defval ){
+        String res = getProperty(key);
+        if( res ){
+            return res;
+        }
+        return defval;
+    }
     public static String getProperty( String key ){
-        switch( key ){
-        case "os.name": return "linux";
-        case "file.separator" : return ".";
-        default: return null;
+        /* Get values for local dwt specific keys */
+        String* p;
+        if (key[0..3] == "dwt") {
+            return ((p = key in localProperties) != null) ? *p : null;
+        /* else get values for global system keys (environment) */
+        } else {
+            switch( key ){
+                case "os.name": return "linux";
+                case "user.name": return "";
+                case "user.home": return "";
+                case "user.dir" : return "";
+                case "file.separator" : return FileConst.PathSeparatorString ;
+                default: return null;
+            }
         }
     }
+
+    public static void setProperty ( String key, String value ) {
+        /* set property for local dwt keys */
+        if (key[0..3] == "dwt") {
+            if (key !is null && value !is null)
+                localProperties[ key ] = value;
+        /* else set properties for global system keys (environment) */
+        } else {
+
+        }
+
+    }
+
+    static class Output {
+        public void println( String str ){
+            implMissing( __FILE__, __LINE__ );
+        }
+    }
+
+    private static Output err__;
+    public static Output err(){
+        if( err__ is null ){
+            err__ = new Output();
+        }
+        return err__;
+    }
+    private static Output out__;
+    public static Output out_(){
+        if( out__ is null ){
+            out__ = new Output();
+        }
+        return out__;
+    }
+
+    private static String[String] localProperties;
 }