diff dmd/File.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 d706d958e4e8
children 5c9b78899f5d
line wrap: on
line diff
--- a/dmd/File.d	Wed Mar 31 16:29:36 2010 +0400
+++ b/dmd/File.d	Sun Apr 04 02:06:32 2010 +0100
@@ -5,7 +5,18 @@
 import dmd.Util;
 
 import core.stdc.stdlib;
-import core.sys.windows.windows;
+version (Windows)
+{
+    import core.sys.windows.windows;
+}
+version (POSIX)
+{
+    import core.sys.posix.fcntl;
+    import core.stdc.errno;
+    import core.sys.posix.unistd;
+    import core.sys.posix.utime;
+    import core.stdc.stdio;
+}
 
 import std.string : toStringz;
 
@@ -72,7 +83,7 @@
 		string name = this.name.toChars();
 
 		//printf("File::read('%s')\n",name);
-		int fd = open(name, O_RDONLY);
+		int fd = open(toStringz(name), O_RDONLY);
 		if (fd == -1) {
 			result = errno;
 			//printf("\topen error, errno = %d\n", errno);
@@ -86,7 +97,7 @@
 		ref_ = 0;       // we own the buffer now
 
 		//printf("\tfile opened\n");
-		stat buf;
+		stat_t buf;
 		if (fstat(fd, &buf)) {
 			printf("\tfstat error, errno = %d\n", errno);
 			goto err2;
@@ -388,11 +399,11 @@
     void remove()		// delete file
 	{
 version (POSIX) {
-		.remove(this.name.toChars());
+		.remove(toStringz(this.name.toChars()));
 } else version (_WIN32) {
 		DeleteFileA(toStringz(this.name.toChars()));
 } else {
 		assert(0);
 }
 	}
-}
\ No newline at end of file
+}