--- deliantra/server/lib/collect.pl.in 2006/02/03 07:13:04 1.1 +++ deliantra/server/lib/collect.pl.in 2006/05/07 13:19:17 1.2 @@ -8,7 +8,7 @@ "\nWhere ARCHDIR is the directory where you stored the ". "raw archetypes.\n". "This script will then create these files:\n". - "archetypes,bmaps,bmaps.paths,faces,treasures.bld,animations.\n" + "archetypes,bmaps,bmaps.paths,faces,smooth,treasures.bld,animations.\n" ) } } @@ -32,7 +32,7 @@ $animations = "animations"; $paths = $bmaps."."."paths"; $faceExt = "\\.[a-zA-Z0-9][A-Z0-9][A-Z0-9]"; -$smooths = "smooth"; +$smooth = "smooth"; ### main &info("looking ..."); @@ -67,7 +67,7 @@ &info("writing ...$archetypes"); open(ARCH,">".$archetypes) || &die("cannot open ".$archetypes); -&archsOut; +&archsOut($root); close(ARCH); @@ -86,8 +86,8 @@ &facesOut; close(FACES); - &info("$smooths"); - open(SMOOTHS,">".$smooths) || &die("cannot open ".$smooths); + &info("$smooth"); + open(SMOOTHS,">".$smooth) || &die("cannot open ".$smooth); &smoothOut; close(SMOOTHS); @@ -219,11 +219,18 @@ sub archsOut { + local($dir) = shift; + foreach $arch (@archs) { + # Assume the filename $arch begins with $dir. Assign all path name + # components after $dir to $pathto. + if($arch =~ /^\Q$dir\E\/(.*)\/[^\/]*[.]arc$/) { + $pathto = $1; + } else { + &warn("cannot determine editor_folder from arch '$arch'"); + $pathto = ""; + } open(ARC,$arch) || &die("cannot open ".$arch); - $pathto = $arch; - $pathto =~ s@[^/]*/@@; - $pathto =~ s@[a-z]*/(.*)/.*arc@$1@; line: while() { chop; ($var,@values) = split; @@ -265,7 +272,7 @@ next line; } if ($var eq "end") { - print ARCH "editor_folder $pathto\n"; + print ARCH "editor_folder $pathto\n" if $pathto ne ""; } if ($var eq "visibility") { $lvis = $values[0];