Index: /gsdl/trunk/perllib/basebuilder.pm
===================================================================
--- /gsdl/trunk/perllib/basebuilder.pm	(revision 15002)
+++ /gsdl/trunk/perllib/basebuilder.pm	(revision 15003)
@@ -322,5 +322,6 @@
     my $dbext = ".bdb";
     $dbext = ".ldb" if &util::is_little_endian();
-    my $fulldbname = &util::filename_cat ($textdir, "$self->{'collection'}$dbext");
+    my $dbname = &util::get_dirsep_tail($self->{'collection'}).$dbext;
+    my $fulldbname = &util::filename_cat ($textdir, $dbname);
     $fulldbname =~ s/\//\\/g if ($ENV{'GSDLOS'} =~ /^windows$/i);
 
@@ -430,5 +431,5 @@
     $build_cfg->{'builddate'} = time;
     $build_cfg->{'buildtype'} = $self->{'buildtype'};
-    $build_cfg->{'indexstem'} = $self->{'collection'};
+    $build_cfg->{'indexstem'} = &util::get_dirsep_tail($self->{'collection'});
     $build_cfg->{'stemindexes'} = $self->{'stemindexes'};
     
Index: /gsdl/trunk/perllib/lucenebuilder.pm
===================================================================
--- /gsdl/trunk/perllib/lucenebuilder.pm	(revision 15002)
+++ /gsdl/trunk/perllib/lucenebuilder.pm	(revision 15003)
@@ -367,5 +367,7 @@
     my $dbext = ".bdb";
     $dbext = ".ldb" if &util::is_little_endian();
-    my $infodb_file = &util::filename_cat($self->{'build_dir'}, "text", $self->{'collection'} . $dbext);
+
+    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
+    my $infodb_file = &util::filename_cat($self->{'build_dir'}, "text", $collect_tail . $dbext);
 
     # If we aren't doing an incremental addition, then we just call the super-
Index: /gsdl/trunk/perllib/mgbuilder.pm
===================================================================
--- /gsdl/trunk/perllib/mgbuilder.pm	(revision 15002)
+++ /gsdl/trunk/perllib/mgbuilder.pm	(revision 15003)
@@ -127,5 +127,7 @@
 
     &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, "text"));
-    my $basefilename = "text/$self->{'collection'}";
+
+    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
+    my $basefilename = &util::filename_cat("text",$collect_tail);
     my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, $basefilename);
 
@@ -315,8 +317,10 @@
     my $indexdir = $self->{'index_mapping'}->{$index};
     &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, $indexdir));
+
+    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
     my $fullindexprefix = &util::filename_cat ($self->{'build_dir'}, $indexdir, 
-					       $self->{'collection'});
+					       $collect_tail);
     my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, "text", 
-					       $self->{'collection'});
+					       $collect_tail);
 
     # get any os specific stuff
@@ -522,5 +526,7 @@
     my $exe = &util::get_os_exe ();
     my $mgstat_exe = &util::filename_cat($exedir, "mgstat$exe");
-    my $input_file = &util::filename_cat ("text", $self->{'collection'});
+
+    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
+    my $input_file = &util::filename_cat ("text", $collect_tail);
     if (!-e "$mgstat_exe" || !open (PIPEIN, "mgstat$exe -d \"$self->{'build_dir'}\" -f \"$input_file\" |")) {
 	print $outhandle "Warning: Couldn't open pipe to $mgstat_exe to get additional stats\n";
Index: /gsdl/trunk/perllib/mgppbuilder.pm
===================================================================
--- /gsdl/trunk/perllib/mgppbuilder.pm	(revision 15002)
+++ /gsdl/trunk/perllib/mgppbuilder.pm	(revision 15003)
@@ -201,8 +201,9 @@
     &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, "text"));
 
-    my $basefilename = "text/$self->{'collection'}";
+    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
+    my $basefilename = &util::filename_cat("text",$collect_tail);
     my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, $basefilename);
     
-   my $osextra = "";
+    my $osextra = "";
     if ($ENV{'GSDLOS'} =~ /^windows$/i) {
 	$fulltextprefix =~ s@/@\\@g;
@@ -402,9 +403,11 @@
     my $indexdir = $self->{'index_mapping'}->{$index};
     &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, $indexdir));
+
+    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
     my $fullindexprefix = &util::filename_cat ($self->{'build_dir'}, 
 					       $indexdir, 
-					       $self->{'collection'});
+					       $collect_tail);
     my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, "text", 
-					       $self->{'collection'});
+					       $collect_tail);
 
     # get any os specific stuff
Index: /gsdl/trunk/perllib/util.pm
===================================================================
--- /gsdl/trunk/perllib/util.pm	(revision 15002)
+++ /gsdl/trunk/perllib/util.pm	(revision 15003)
@@ -703,4 +703,19 @@
 
 
+sub get_dirsep_tail {
+    my ($filename) = @_;
+    
+    # returns last part of directory or filename
+    # On unix e.g. a/b.d => b.d
+    #              a/b/c => c
+
+    my $dirsep = get_dirsep();
+    
+    my ($tail) = ($filename =~ m/^(?:.*?$dirsep)?(.*?)$/);
+
+    return $tail;
+}
+
+
 # if this is running on windows we want binaries to end in
 # .exe, otherwise they don't have to end in any extension
