Index: /main/trunk/greenstone2/cgi-bin/build-server.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/build-server.pl	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/build-server.pl	(revision 24872)
@@ -23,6 +23,11 @@
 if ($iis6_mode)
 {
-    # Change into cgi-bin directory
+    # Change into cgi-bin\<OS> directory
     chdir("cgi-bin");
+    if(defined $ENV{'GSDLARCH'}) {
+	chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
+    } else {
+	chdir($ENV{'GSDLOS'});
+    }
 }
 
Index: /main/trunk/greenstone2/cgi-bin/experimental-ocr-server.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/experimental-ocr-server.pl	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/experimental-ocr-server.pl	(revision 24872)
@@ -26,6 +26,11 @@
 if ($iis6_mode)
 {
-    # Change into cgi-bin directory
+    # Change into cgi-bin\<OS> directory
     chdir("cgi-bin");
+    if(defined $ENV{'GSDLARCH'}) {
+	chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
+    } else {
+	chdir($ENV{'GSDLOS'});
+    }
 }
 
Index: /main/trunk/greenstone2/cgi-bin/explode-server.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/explode-server.pl	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/explode-server.pl	(revision 24872)
@@ -22,6 +22,11 @@
 if ($iis6_mode)
 {
-    # Change into cgi-bin directory
+    # Change into cgi-bin\<OS> directory
     chdir("cgi-bin");
+    if(defined $ENV{'GSDLARCH'}) {
+	chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
+    } else {
+	chdir($ENV{'GSDLOS'});
+    }
 }
 
Index: /main/trunk/greenstone2/cgi-bin/gliserver.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/gliserver.pl	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/gliserver.pl	(revision 24872)
@@ -25,7 +25,12 @@
 if ($iis6_mode)
 {
-    # Change into cgi-bin directory - need to ensure it exists, since gliserver deals with both GS2 and GS3
+    # Change into cgi-bin\<OS> directory - need to ensure it exists, since gliserver deals with both GS2 and GS3
     if(-e "cgi-bin" && -d "cgi-bin") { # GS2
 	chdir("cgi-bin");
+	if(defined $ENV{'GSDLARCH'}) {
+	    chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
+	} else {
+	    chdir($ENV{'GSDLOS'});
+	}
     } else { # iis6_mode is not applicable for Greenstone 3
 	$iis6_mode = 0;
Index: /main/trunk/greenstone2/cgi-bin/gsdlCGI.pm
===================================================================
--- /main/trunk/greenstone2/cgi-bin/gsdlCGI.pm	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/gsdlCGI.pm	(revision 24872)
@@ -495,5 +495,8 @@
     $self->{'library_url_suffix'} = $library_url;
 
-    unshift(@INC, "$ENV{'GSDLHOME'}/cgi-bin"); # This is OK on Windows
+    my $cgibin = "cgi-bin/$ENV{'GSDLOS'}";
+    $cgibin = $cgibin.$ENV{'GSDLARCH'} if defined $ENV{'GSDLARCH'};
+
+    unshift(@INC, "$ENV{'GSDLHOME'}/$cgibin"); # This is OK on Windows
     unshift(@INC, "$ENV{'GSDLHOME'}/perllib");
     unshift(@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
Index: /main/trunk/greenstone2/cgi-bin/image-server.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/image-server.pl	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/image-server.pl	(revision 24872)
@@ -14,6 +14,11 @@
 if ($iis6_mode)
 {
-    # Change into cgi-bin directory
+    # Change into cgi-bin\<OS> directory
     chdir("cgi-bin");
+    if(defined $ENV{'GSDLARCH'}) {
+	chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
+    } else {
+	chdir($ENV{'GSDLOS'});
+    }
 }
 
Index: /main/trunk/greenstone2/cgi-bin/index-server.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/index-server.pl	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/index-server.pl	(revision 24872)
@@ -22,6 +22,11 @@
 if ($iis6_mode)
 {
-    # Change into cgi-bin directory
+    # Change into cgi-bin\<OS> directory
     chdir("cgi-bin");
+    if(defined $ENV{'GSDLARCH'}) {
+	chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
+    } else {
+	chdir($ENV{'GSDLOS'});
+    }
 }
 
Index: /main/trunk/greenstone2/cgi-bin/metadata-server.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/metadata-server.pl	(revision 24871)
+++ /main/trunk/greenstone2/cgi-bin/metadata-server.pl	(revision 24872)
@@ -23,6 +23,11 @@
 if ($iis6_mode)
 {
-    # Change into cgi-bin directory
+    # Change into cgi-bin\<OS> directory
     chdir("cgi-bin");
+    if(defined $ENV{'GSDLARCH'}) {
+	chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
+    } else {
+	chdir($ENV{'GSDLOS'});
+    }
 }
 
