[Thread Prev][Thread Next][Thread Index]
Installer.pm patched (was: Strings with spaces)
- To: jim@xxxxxxxxxx
- Subject: Installer.pm patched (was: Strings with spaces)
- From: Jim Nicholson <jim@xxxxxxxxxx>
- Date: Wed, 29 Jul 1998 09:56:25 -0400 (EDT)
- Cc: Alan.Harder@Ebay (Alan Harder), Pilot Manager <pilotmgr@xxxxxxxxxxxxxxxxxxxx>, Ernie Brouwer <ebrouwer@xxxxxxxxxxxxxxxxxxxxx>
- In-reply-to: <13758.38525.464618.237276@osiris.pcks.com>
- References: <199807281633.JAA11888@moshpit.EBay.Sun.COM> <13758.38525.464618.237276@osiris.pcks.com>
- Reply-to: jim@xxxxxxxxxx
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;