Changeset 28394


Ignore:
Timestamp:
10/14/13 09:58:09 (7 years ago)
Author:
davidb
Message:

Further support for operation under Cygwin added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/util.pm

    r28375 r28394  
    358358
    359359
    360 sub pathname_cat {
    361     my $first_path = shift(@_);
     360sub _pathname_cat {
     361    my $join_char  = shift(@_);
     362    my $first_path = shift(@_);
    362363    my (@pathnames) = @_;
    363364
     
    366367    unshift(@pathnames, $first_path);
    367368    }
     369
     370    my $pathname = join($join_char, @pathnames);
     371
     372    # remove duplicate slashes
     373    if ($join_char eq ";") {
     374    $pathname =~ s/[\\\/]+/\\/g;
     375    } else {
     376    $pathname =~ s/[\/]+/\//g;
     377    # DB: want a pathname abc\de.html to remain like this
     378    }
     379
     380    return $pathname;
     381}
     382
     383
     384sub pathname_cat {
     385    my (@pathnames) = @_;
    368386
    369387    my $join_char;
     
    373391    $join_char = ":";
    374392    }
    375 
    376     my $pathname = join($join_char, @pathnames);
    377 
    378     # remove duplicate slashes
    379     if (($ENV{'GSDLOS'} =~ /^windows$/i) && ($^O ne "cygwin")) {
    380     $pathname =~ s/[\\\/]+/\\/g;
     393    return _pathname_cat($join_char,@pathnames);
     394}
     395
     396
     397sub javapathname_cat {
     398    my (@pathnames) = @_;
     399
     400    my $join_char;
     401
     402    # Unlike pathname_cat() above, not interested if running in a Cygwin environment
     403    # This is because the java we run is actually a native Windows executable
     404
     405    if (($ENV{'GSDLOS'} =~ /^windows$/i)) {
     406    $join_char = ";";
    381407    } else {
    382     $pathname =~ s/[\/]+/\//g;
    383     # DB: want a pathname abc\de.html to remain like this
    384     }
    385 
    386     return $pathname;
    387 }
     408    $join_char = ":";
     409    }
     410    return _pathname_cat($join_char,@pathnames);
     411}
     412
    388413
    389414
     
    445470    }
    446471}
     472
    447473
    448474
Note: See TracChangeset for help on using the changeset viewer.