diff dmd/FileName.d @ 16:5c9b78899f5d

Implemented methods for Tuples, fixed some linking issues.
author Robert Clipsham <robert@octarineparrot.com>
date Sun, 04 Apr 2010 22:41:11 +0100
parents 2cc604139636
children 544b922227c7
line wrap: on
line diff
--- a/dmd/FileName.d	Sun Apr 04 02:15:33 2010 +0100
+++ b/dmd/FileName.d	Sun Apr 04 22:41:11 2010 +0100
@@ -504,7 +504,32 @@
 		
 		return null;
 	}
-	
+
+	static string searchPath(string[] path, string name, bool cwd)
+	{
+		if (absolute(name)) {
+			return exists(name) ? name : null;
+		}
+		
+		if (cwd) {
+			if (exists(name)) {
+				return name;
+			}
+		}
+		
+		if (path !is null) {
+			foreach (i, p; path)
+			{
+				string n = combine(p, name);
+
+				if (exists(n))
+					return n;
+			}
+		}
+		
+		return null;
+	}
+
     static int exists(string name)
 	{
 version (POSIX) {