diff dmd/File.d @ 22:fd4acc376c45

Implemented object file output and linking on linux.
author Robert Clipsham <robert@octarineparrot.com>
date Thu, 08 Apr 2010 04:21:03 +0100
parents 5c9b78899f5d
children e28b18c23469
line wrap: on
line diff
--- a/dmd/File.d	Wed Apr 07 00:51:29 2010 +0100
+++ b/dmd/File.d	Thu Apr 08 04:21:03 2010 +0100
@@ -243,18 +243,16 @@
     int write()
 	{
 version (POSIX) {
-		assert(false);
-		/+
+		//assert(false);
+		
 		int fd;
 		ssize_t numwritten;
-		char *name;
-
-		name = this->name->toChars();
+		const(char)* name = toStringz(this.name.toChars());
 		fd = open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644);
 		if (fd == -1)
 		goto err;
 
-		numwritten = ::write(fd, buffer, len);
+		numwritten = core.sys.posix.unistd.write(fd, buffer, len);
 		if (len != numwritten)
 		goto err2;
 		
@@ -262,10 +260,10 @@
 		goto err;
 
 		if (touchtime)
-		{   struct utimbuf ubuf;
+		{   utimbuf ubuf;
 
-			ubuf.actime = ((struct stat *)touchtime)->st_atime;
-			ubuf.modtime = ((struct stat *)touchtime)->st_mtime;
+			ubuf.actime = (cast(stat_t *)touchtime).st_atime;
+			ubuf.modtime = (cast(stat_t *)touchtime).st_mtime;
 		if (utime(name, &ubuf))
 			goto err;
 		}
@@ -273,10 +271,10 @@
 
 	err2:
 		close(fd);
-		::remove(name);
+		.remove(name);
 	err:
 		return 1;
-		+/
+		
 } else version (_WIN32) {
 		HANDLE h;
 		DWORD numwritten;