Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/CollectionConstructor.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/CollectionConstructor.java	(revision 24882)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/CollectionConstructor.java	(revision 24883)
@@ -1,3 +1,5 @@
 package org.greenstone.gsdl3.build;
+
+import java.io.File;
 
 import org.greenstone.gsdl3.util.*;
@@ -12,4 +14,6 @@
     /** the site in which building is to take place */
     protected String site_home = null;
+    /** the name of the site*/
+    protected String site_name = null;
     /** the name of the collection */
     protected String collection_name = null;
@@ -42,4 +46,7 @@
     public void setSiteHome(String site_home) {
 	this.site_home = site_home;
+	
+	File siteHomeFile = new File(site_home);
+	this.site_name = siteHomeFile.getName();
     }
     public void setCollectionName(String coll_name) {
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 24882)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 24883)
@@ -3,4 +3,5 @@
 // greenstome classes
 import org.greenstone.gsdl3.util.*;
+import org.greenstone.util.GlobalProperties;
 
 // xml classes
@@ -10,6 +11,9 @@
 //general java classes
 import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
 import java.io.InputStreamReader;
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Vector;
 
@@ -47,11 +51,12 @@
 	{
 		// try to get the environment variables
-		this.gsdl2home = System.getProperty("GSDLHOME");
-		this.gsdl3home = System.getProperty("GSDL3HOME");
-		this.gsdlos = System.getProperty("GSDLOS");
-		this.path = System.getProperty("PATH");
+		this.gsdl3home = GlobalProperties.getGSDL3Home();
+		this.gsdl2home = this.gsdl3home + File.separator + ".." + File.separator + "gs2build";
+		this.gsdlos = System.getProperty("os.name").startsWith("Windows") ? "Windows" : "Linux";
+		this.path = System.getenv("PATH");
+
 		if (this.gsdl2home == null)
 		{
-			System.err.println("You must have greenstone2 installed, and GSDLHOME set for GS2Perl building to work!!");
+			System.err.println("You must have gs2build installed, and GSDLHOME set for GS2Perl building to work!!");
 			return false;
 		}
@@ -162,9 +167,14 @@
 		sendMessage(new ConstructionEvent(this, GSStatus.INFO, "Collection construction: build collection."));
 		Vector command = new Vector();
-		command.add("buildcol.pl");
+		command.add(GlobalProperties.getProperty("perl.path", "perl"));
+		command.add("-S");
+		command.add(GlobalProperties.getGS2Build() + File.separator + "bin" + File.separator + "script" + File.separator + "buildcol.pl");
+		command.add("-site");
+		command.add(this.site_name);
 		command.add("-collectdir");
 		command.add(GSFile.collectDir(this.site_home));
 		command.addAll(extractParameters(this.process_params));
 		command.add(this.collection_name);
+
 		String[] command_str = {};
 		command_str = (String[]) command.toArray(command_str);
@@ -175,6 +185,4 @@
 			sendProcessComplete(new ConstructionEvent(this, GSStatus.COMPLETED, ""));
 		}// else an error message has already been sent, do nothing
-			//  	    
-
 	}
 
@@ -196,8 +204,9 @@
 		{
 			sendMessage(new ConstructionEvent(this, GSStatus.INFO, "deleting index directory"));
-			index_dir.delete();
+			GSFile.deleteFile(index_dir);
 			if (index_dir.exists())
 			{
-				sendMessage(new ConstructionEvent(this, GSStatus.INFO, "index directory still exists!"));
+				sendMessage(new ConstructionEvent(this, GSStatus.ERROR, "index directory still exists!"));
+				return;
 			}
 		}
@@ -207,20 +216,4 @@
 		{
 			sendMessage(new ConstructionEvent(this, GSStatus.ERROR, "index dir wasn't created!"));
-		}
-
-		// run the convert coll script to convert the gs2 coll to gs3
-		Vector command = new Vector();
-		command.add("convert_coll_from_gs2.pl");
-		command.add("-collectdir");
-		command.add(GSFile.collectDir(this.site_home));
-		command.addAll(extractParameters(this.process_params));
-		command.add(this.collection_name);
-		String[] command_str = {};
-		command_str = (String[]) command.toArray(command_str);
-
-		if (!runPerlCommand(command_str))
-		{
-			// an error has occurred, dont carry on
-			return;
 		}
 
@@ -264,5 +257,15 @@
 		ConstructionEvent evt;
 
-		String args[] = { "GSDLHOME=" + this.gsdl2home, "GSDL3HOME=" + this.gsdl3home, "GSDLOS=" + this.gsdlos, "PATH=" + this.path };
+		ArrayList<String> args = new ArrayList<String>();
+		args.add("GSDLHOME=" + this.gsdl2home);
+		args.add("GSDL3HOME=" + this.gsdl3home);
+		args.add("GSDLOS=" + this.gsdlos);
+		args.add("GSDL-RUN-SETUP=true");
+
+		for (String a : System.getenv().keySet())
+		{
+			args.add(a + "=" + System.getenv(a));
+		}
+
 		String command_str = "";
 		for (int i = 0; i < command.length; i++)
@@ -270,4 +273,5 @@
 			command_str = command_str + command[i] + " ";
 		}
+
 		sendMessage(new ConstructionEvent(this, GSStatus.INFO, "command = " + command_str));
 		try
@@ -275,5 +279,5 @@
 			Runtime rt = Runtime.getRuntime();
 			sendProcessBegun(new ConstructionEvent(this, GSStatus.ACCEPTED, "starting"));
-			Process prcs = rt.exec(command, args);
+			Process prcs = rt.exec(command, args.toArray(new String[args.size()]));
 
 			InputStreamReader eisr = new InputStreamReader(prcs.getErrorStream());
@@ -283,4 +287,8 @@
 			// Captures the std err of a program and pipes it into
 			// std in of java
+
+			BufferedWriter bw = new BufferedWriter(new FileWriter(GSFile.collectDir(this.site_home) + File.separator + this.collection_name + File.separator + "log" + File.separator + "build_log." + (System.currentTimeMillis()) + ".txt"));
+			bw.write("Document Editor Build\n");
+
 			String eline = null;
 			String stdinline = null;
@@ -289,11 +297,17 @@
 				if (eline != null)
 				{
+					//System.err.println("ERROR: " + eline);
+					bw.write(eline + "\n");
 					sendProcessStatus(new ConstructionEvent(this, GSStatus.CONTINUING, eline));
 				}
 				if (stdinline != null)
 				{
+					//System.err.println("OUT: " + stdinline);
+					bw.write(stdinline + "\n");
 					sendProcessStatus(new ConstructionEvent(this, GSStatus.CONTINUING, stdinline));
 				}
 			}
+			bw.close();
+
 			if (!this.cancel)
 			{
