summaryrefslogtreecommitdiff
path: root/modules/DirectoryManager.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2005-11-21 15:26:51 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2005-11-21 15:26:51 +0000
commite5a235cad6a624d1be41543636a80fc526f906a5 (patch)
tree57fe99174a258fe3e8cfc36f1afbc880fcf2bdad /modules/DirectoryManager.pm
parentf003a7abf1334fda4548db353ffac931916d9309 (diff)
downloadMPC-e5a235cad6a624d1be41543636a80fc526f906a5.tar.gz
ChangeLogTag: Mon Nov 21 09:26:35 2005 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/DirectoryManager.pm')
-rw-r--r--modules/DirectoryManager.pm68
1 files changed, 60 insertions, 8 deletions
diff --git a/modules/DirectoryManager.pm b/modules/DirectoryManager.pm
index 8e815738..2a9b0b1c 100644
--- a/modules/DirectoryManager.pm
+++ b/modules/DirectoryManager.pm
@@ -30,6 +30,9 @@ if ($^O eq 'cygwin' && $cwd !~ /[A-Za-z]:/) {
chop($cwd = $cyg);
}
}
+elsif ($^O eq 'VMS') {
+ $cwd = unixify($cwd);
+}
my($start) = $cwd;
# ************************************************************
@@ -52,12 +55,15 @@ sub cd {
if ($dir =~ /\.\./) {
$cwd = Cwd::getcwd();
if ($^O eq 'cygwin' && $cwd !~ /[A-Za-z]:/) {
- my($cyg) = `cygpath -w $cwd`;
- if (defined $cyg) {
- $cyg =~ s/\\/\//g;
- chop($cwd = $cyg);
- }
- }
+ my($cyg) = `cygpath -w $cwd`;
+ if (defined $cyg) {
+ $cyg =~ s/\\/\//g;
+ chop($cwd = $cyg);
+ }
+ }
+ elsif ($^O eq 'VMS') {
+ $cwd = unixify($cwd);
+ }
}
else {
if ($dir =~ /^(\/|[a-z]:)/i) {
@@ -86,11 +92,57 @@ sub getstartdir {
sub mpc_dirname {
my($self) = shift;
my($dir) = shift;
- return ($^O ne 'VMS' ? File::Basename::dirname($dir) :
- unixify(File::Basename::dirname($dir)));
+
+ if ($^O eq 'VMS') {
+ if ($dir =~ /\//) {
+ return unixify(dirname($dir));
+ }
+ else {
+ return '.';
+ }
+ }
+ else {
+ return dirname($dir);
+ }
}
+sub mpc_glob {
+ my($self) = shift;
+ my($pattern) = shift;
+ my(@files) = ();
+
+ ## glob() provided by OpenVMS does not understand [] within
+ ## the pattern. So, we implement our own through recursive calls
+ ## to mpc_glob().
+ if ($^O eq 'VMS' && $pattern =~ /(.*)\[([^\]]+)\](.*)/) {
+ my($pre) = $1;
+ my($mid) = $2;
+ my($post) = $3;
+ for(my $i = 0; $i < length($mid); $i++) {
+ my($p) = $pre . substr($mid, $i, 1) . $post;
+ my(@new) = $self->mpc_glob($p);
+ foreach my $new ($self->mpc_glob($p)) {
+ my($found) = undef;
+ foreach my $file (@files) {
+ if ($file eq $new) {
+ $found = 1;
+ last;
+ }
+ }
+ if (!$found) {
+ push(@files, $new);
+ }
+ }
+ }
+ }
+ else {
+ push(@files, glob($pattern));
+ }
+
+ return @files;
+}
+
# ************************************************************
# Virtual Methods To Be Overridden
# ************************************************************