diff dmd/FileName.d @ 14:2cc604139636

Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
author Robert Clipsham <robert@octarineparrot.com>
date Sun, 04 Apr 2010 02:06:32 +0100
parents 63623152e82a
children 5c9b78899f5d
line wrap: on
line diff
--- a/dmd/FileName.d	Wed Mar 31 16:29:36 2010 +0400
+++ b/dmd/FileName.d	Sun Apr 04 02:06:32 2010 +0100
@@ -15,7 +15,17 @@
 import std.string : cmp, icmp;
 import std.file : mkdirRecurse;
 
-import core.sys.windows.windows;
+version (Windows)
+{
+    import core.sys.windows.windows;
+}
+
+version (POSIX)
+{
+    import core.stdc.stdlib;
+    import core.sys.posix.sys.stat;
+    import std.conv;
+}
 
 class FileName : String
 {
@@ -359,7 +369,7 @@
 
 	version (POSIX) {
 						case '~':
-							buf.writestring(getenv("HOME"));
+							buf.writestring(to!string(getenv("HOME")));
 							continue;
 	}
 
@@ -454,7 +464,7 @@
 version (_WIN32) {
 		file.touchtime = GC.malloc(WIN32_FIND_DATA.sizeof);	// keep same file time
 } else version (POSIX) {
-		file.touchtime = GC.malloc(stat.sizeof); // keep same file time
+		file.touchtime = GC.malloc(stat_t.sizeof); // keep same file time
 } else {
 		static assert(0);
 }
@@ -498,9 +508,9 @@
     static int exists(string name)
 	{
 version (POSIX) {
-		stat st;
+		stat_t st;
 
-		if (stat(name, &st) < 0)
+		if (stat(toStringz(name), &st) < 0)
 			return 0;
 		if (S_ISDIR(st.st_mode))
 			return 2;
@@ -534,4 +544,4 @@
 		} catch {
 		}
 	}
-}
\ No newline at end of file
+}