added validation for <directory>'s name attribute
create dk/nkm/lib if it doesn't exist
Modified: branches/xmlbuildsystem/reactos/Makefile
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h

Modified: branches/xmlbuildsystem/reactos/Makefile
--- branches/xmlbuildsystem/reactos/Makefile	2005-03-13 05:32:52 UTC (rev 13993)
+++ branches/xmlbuildsystem/reactos/Makefile	2005-03-13 06:31:38 UTC (rev 13994)
@@ -100,15 +100,19 @@
 endif
 
 ifneq ($(ROS_INTERMEDIATE),)
-$(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE)
-	${nmkdir} $(ROS_INTERMEDIATE)tools
-endif
-
-ifneq ($(ROS_INTERMEDIATE),)
 $(ROS_INTERMEDIATE):
 	${nmkdir} $(ROS_INTERMEDIATE)
+$(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE)
+	${nmkdir} $@
+$(ROS_INTERMEDIATE)dk: $(ROS_INTERMEDIATE)
+	${nkmdir} $@
+$(ROS_INTERMEDIATE)dk$(SEP)nkm: $(ROS_INTERMEDIATE)dk
+	${nkmdir} $@
 endif
 
+$(ROS_INTERMEDIATE)dk$(SEP)nkm$(SEP)lib: $(ROS_INTERMEDIATE)dk$(SEP)nkm
+	${nmkdir} $@
+
 NTOSKRNL_MC = .$(SEP)ntoskrnl$(SEP)ntoskrnl.mc
 KERNEL32_MC = .$(SEP)lib$(SEP)kernel32$(SEP)kernel32.mc
 BUILDNO_H = .$(SEP)include$(SEP)reactos$(SEP)buildno.h

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp	2005-03-13 05:32:52 UTC (rev 13993)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp	2005-03-13 06:31:38 UTC (rev 13994)
@@ -179,8 +179,8 @@
 		vout.push_back ( vpath[i++] );
 
 	// now merge vout into a string again
-	string out = ".";
-	for ( i = 0; i < vout.size(); i++ )
+	string out = vout[0];
+	for ( i = 1; i < vout.size(); i++ )
 	{
 		out += "/" + vout[i];
 	}

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-03-13 05:32:52 UTC (rev 13993)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-03-13 06:31:38 UTC (rev 13994)
@@ -20,6 +20,25 @@
 }
 
 string
+GetSubPath (
+	const string& location,
+	const string& path,
+	const string& att_value )
+{
+	if ( !att_value.size() )
+		throw InvalidBuildFileException (
+			location,
+			"<directory> tag has empty 'name' attribute" );
+	if ( strpbrk ( att_value.c_str (), "/\\?*:<>|" ) )
+		throw InvalidBuildFileException (
+			location,
+			"<directory> tag has invalid characters in 'name' attribute" );
+	if ( !path.size() )
+		return att_value;
+	return FixSeparator(path + CSEP + att_value);
+}
+
+string
 GetExtension ( const string& filename )
 {
 	size_t index = filename.find_last_of ( '/' );
@@ -252,7 +271,7 @@
 	{
 		const XMLAttribute* att = e.GetAttribute ( "name", true );
 		assert(att);
-		subpath = FixSeparator ( path + CSEP + att->value );
+		subpath = GetSubPath ( e.location, path, att->value );
 	}
 	else if ( e.name == "include" )
 	{
@@ -508,10 +527,10 @@
 {
 	if ( HasImportLibrary () )
 	{
-		return ssprintf ( "dk%snkm%slib%slib%s.a",
-		                  SSEP,
-		                  SSEP,
-		                  SSEP,
+		return ssprintf ( "dk%cnkm%clib%clib%s.a",
+		                  CSEP,
+		                  CSEP,
+		                  CSEP,
 		                  name.c_str () );
 	}
 	else

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp	2005-03-13 05:32:52 UTC (rev 13993)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp	2005-03-13 06:31:38 UTC (rev 13994)
@@ -182,7 +182,8 @@
 		if ( head->subElements[i]->name == "project" )
 		{
 			node = head->subElements[i];
-			this->ProcessXML ( "." );
+			string path;
+			this->ProcessXML ( path );
 			return;
 		}
 	}
@@ -254,7 +255,7 @@
 	{
 		const XMLAttribute* att = e.GetAttribute ( "name", true );
 		assert(att);
-		subpath = path + CSEP + att->value;
+		subpath = GetSubPath ( e.location, path, att->value );
 	}
 	else if ( e.name == "include" )
 	{

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-03-13 05:32:52 UTC (rev 13993)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-03-13 06:31:38 UTC (rev 13994)
@@ -6,15 +6,17 @@
 #ifdef WIN32
 #include <direct.h>
 #include <io.h>
-#endif
+#endif/*WIN32*/
 #include <sys/stat.h>
 #include <time.h>
 #ifdef _MSC_VER
 #include <sys/utime.h>
-#else
+#else/*_MSC_VER*/
 #include <utime.h>
+#ifdef WIN32
 #include <process.h>
-#endif
+#endif/*WIN32*/
+#endif/*_MSC_VER*/
 
 #include "ssprintf.h"
 #include "exception.h"
@@ -524,11 +526,16 @@
 	void ProcessXML();
 };
 
-
 extern std::string
 FixSeparator ( const std::string& s );
 
 extern std::string
+GetSubPath (
+	const std::string& location,
+	const std::string& path,
+	const std::string& att_value );
+
+extern std::string
 GetExtension ( const std::string& filename );
 
 extern std::string