Răsfoiți Sursa

one more relDir fix

ncannasse 6 ani în urmă
părinte
comite
32e0f1dfc7
2 a modificat fișierele cu 37 adăugiri și 31 ștergeri
  1. 33 27
      other/haxelib/Run.hx
  2. 4 4
      other/haxelib/templates/vs2015/__file__.vcxproj

+ 33 - 27
other/haxelib/Run.hx

@@ -46,12 +46,42 @@ class Build {
 			else 
 			else 
 				relDir = currentAbs.substr(targetAbs.length+1);
 				relDir = currentAbs.substr(targetAbs.length+1);
 			relDir = relDir.split("\\").join("/");
 			relDir = relDir.split("\\").join("/");
+			if( relDir != "" )
+				relDir += "/";
 		}
 		}
 		if( !sys.FileSystem.exists(srcDir) ) {
 		if( !sys.FileSystem.exists(srcDir) ) {
 			srcDir = dataPath + "templates/"+tpl;
 			srcDir = dataPath + "templates/"+tpl;
 			if( !sys.FileSystem.exists(srcDir) )
 			if( !sys.FileSystem.exists(srcDir) )
 				throw "Failed to find make template '"+tpl+"'";
 				throw "Failed to find make template '"+tpl+"'";
 		}
 		}
+		
+		var allFiles = config.files.copy();
+		for( f in config.files )
+			if( StringTools.endsWith(f,".c") ) {
+				var h = f.substr(0,-2) + ".h";
+				if( sys.FileSystem.exists(targetDir+h) )
+					allFiles.push(h);
+			}
+		allFiles.sort(Reflect.compare);
+
+		var files = [for( f in allFiles ) { path : f, directory : new haxe.io.Path(f).dir }];
+		var directories = new Map();
+		for( f in files )
+			if( f.directory != null )
+				directories.set(f.directory, true);
+		for( k in directories.keys() ) {
+			var dir = k.split("/");
+			dir.pop();
+			while( dir.length > 0 ) {
+				var p = dir.join("/");
+				directories.set(p, true);
+				dir.pop();
+			}
+		}
+
+		var directories = [for( k in directories.keys() ) { path : k }];
+		directories.sort(function(a,b) return Reflect.compare(a.path,b.path));
+		
 		function genRec( path : String ) {
 		function genRec( path : String ) {
 			var dir = srcDir + "/" + path;
 			var dir = srcDir + "/" + path;
 			for( f in sys.FileSystem.readDirectory(dir) ) {
 			for( f in sys.FileSystem.readDirectory(dir) ) {
@@ -64,33 +94,6 @@ class Build {
 				}
 				}
 				var content = sys.io.File.getContent(srcPath);
 				var content = sys.io.File.getContent(srcPath);
 				var tpl = new haxe.Template(content);
 				var tpl = new haxe.Template(content);
-				var allFiles = config.files.copy();
-				for( f in config.files )
-					if( StringTools.endsWith(f,".c") ) {
-						var h = f.substr(0,-2) + ".h";
-						if( sys.FileSystem.exists(targetDir+h) )
-							allFiles.push(h);
-					}
-				allFiles.sort(Reflect.compare);
-
-				var files = [for( f in allFiles ) { path : f, directory : new haxe.io.Path(f).dir }];
-				var directories = new Map();
-				for( f in files )
-					if( f.directory != null )
-						directories.set(f.directory, true);
-				for( k in directories.keys() ) {
-					var dir = k.split("/");
-					dir.pop();
-					while( dir.length > 0 ) {
-						var p = dir.join("/");
-						directories.set(p, true);
-						dir.pop();
-					}
-				}
-
-				var directories = [for( k in directories.keys() ) { path : k }];
-				directories.sort(function(a,b) return Reflect.compare(a.path,b.path));
-
 				content = tpl.execute({
 				content = tpl.execute({
 					name : this.name,
 					name : this.name,
 					libraries : [for( l in config.libs ) if( l != "std" ) { name : l }],
 					libraries : [for( l in config.libs ) if( l != "std" ) { name : l }],
@@ -105,6 +108,9 @@ class Build {
 						sha1 = sha1.toUpperCase();
 						sha1 = sha1.toUpperCase();
 						return sha1.substr(0,8)+"-"+sha1.substr(8,4)+"-"+sha1.substr(12,4)+"-"+sha1.substr(16,4)+"-"+sha1.substr(20,12);
 						return sha1.substr(0,8)+"-"+sha1.substr(8,4)+"-"+sha1.substr(12,4)+"-"+sha1.substr(16,4)+"-"+sha1.substr(20,12);
 					},
 					},
+					makePath : function(_,dir:String) {
+						return dir == "" ? "./" : (StringTools.endsWith(dir,"/") || StringTools.endsWith(dir,"\\")) ? dir : dir + "/";
+					},
 					winPath : function(_,s:String) return s.split("/").join("\\"),
 					winPath : function(_,s:String) return s.split("/").join("\\"),
 				});
 				});
 				var prevContent = try sys.io.File.getContent(targetPath) catch( e : Dynamic ) null;
 				var prevContent = try sys.io.File.getContent(targetPath) catch( e : Dynamic ) null;

+ 4 - 4
other/haxelib/templates/vs2015/__file__.vcxproj

@@ -71,22 +71,22 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>true</LinkIncremental>
     <LinkIncremental>true</LinkIncremental>
-    <IncludePath>.;$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
+    <IncludePath>$$makePath(::relDir::);$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/$(Configuration);$(LibraryPath)</LibraryPath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/$(Configuration);$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <LinkIncremental>true</LinkIncremental>
     <LinkIncremental>true</LinkIncremental>
-    <IncludePath>.;$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
+    <IncludePath>$$makePath(::relDir::);$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/x64/$(Configuration);$(LibraryPath)</LibraryPath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/x64/$(Configuration);$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
     <LinkIncremental>false</LinkIncremental>
-    <IncludePath>.;$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
+    <IncludePath>$$makePath(::relDir::);$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/$(Configuration);$(LibraryPath)</LibraryPath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/$(Configuration);$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <LinkIncremental>false</LinkIncremental>
     <LinkIncremental>false</LinkIncremental>
-    <IncludePath>.;$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
+    <IncludePath>$$makePath(::relDir::);$(HASHLINK)/include;$(HASHLINK)/src;$(IncludePath)</IncludePath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/x64/$(Configuration);$(LibraryPath)</LibraryPath>
     <LibraryPath>$(HASHLINK);$(HASHLINK)/x64/$(Configuration);$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">