[Thread Prev][Thread Next][Thread Index]

Installer.pm patched (was: Strings with spaces)



Here's a patch to Installer.pm. This allows you to install files
that have spaces in them. If you'd rather not patch the file yourself, 
email me and I'll send you the full (8k) script.

The patch replaces glob operator calls with a function that uses
readdir.

(BTW - I diff'd against the Installer from latest.dev.tar.gz)

--- Installer.pm.latest	Wed Jul 29 09:05:29 1998
+++ Installer.pm	Wed Jul 29 09:02:38 1998
@@ -27,6 +27,7 @@
 use Tk;
 require "MultiFileSelect.pm";	# Change back to "use Tk::FileSelect;" if Tk
 use TkUtils;			# gets updated with Adam's changes!
+use File::Basename;
 use strict;
 
 # Multiple file selection ability in version 1.006 added by Adam Stein.
@@ -236,9 +237,11 @@
     $sel = $gInstallList->curselection;
 
     $gInstallList->delete(0, "end");
-    foreach $file (<$RCDIR/*>)
+    foreach $file (FileList($RCDIR))
     {
-	next if ($file eq $RCFILE);
+	next if ($file eq basename($RCFILE));
+	next if ($file eq '.');
+	next if ($file eq '..');
 
 	$file =~ s|.*/||;
 	$gInstallList->insert("end", $file);
@@ -267,7 +270,7 @@
 
     my ($count, $count_max);
     
-    @file_list = <$RCDIR/*>;
+    @file_list = FileList($RCDIR);
 
     $changed = 0;
     $count = 0;
@@ -276,7 +279,9 @@
     {
 	my ($name);
 
-	next if ($file eq $RCFILE);
+	next if ($file eq basename($RCFILE));
+	next if ($file eq '.');
+	next if ($file eq '..');
 
 	($name = $file) =~ s|.*/||;
 
@@ -286,7 +291,7 @@
 
 	if (&installDB($dlp, $file))
 	{
-	    unlink($file);
+	    unlink("$RCDIR/$file");
 	    $dlp->log("Installer: installed $name\n");
 	    $changed++;
 	}
@@ -302,7 +307,7 @@
     {
 	$CANCEL = 0;
 	PilotMgr::msg("Install cancelled.\n" .
-		      "Installed$count out of $count_max databases");
+		      "Installed $count out of $count_max databases");
     }
     else
     {
@@ -371,8 +376,8 @@
 {
     my ($dlp, $filename) = @_;
     my ($file, $err);
-
-    $file = PDA::Pilot::File::open($filename);
+    PilotMgr::msg("installDB: " . $filename);
+    $file = PDA::Pilot::File::open("$RCDIR/$filename");
     return 0 unless $file;
 
     $dlp->getStatus();
@@ -388,5 +393,16 @@
 
     return 1;
 }
+
+sub FileList {
+  my ($dir) = @_;
+  opendir FOO,$dir;
+  my @list = readdir FOO;
+  foreach (@list) {
+  }
+  closedir FOO;
+  return @list;
+}
+
 
 1;




SourceForge.net Logo