Changeset 28393

Show
Ignore:
Timestamp:
14.10.2013 09:57:33 (6 years ago)
Author:
davidb
Message:

Support for Cygwin added

Files:
1 modified

Legend:

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

    r27762 r28393  
    495495 
    496496  # remove duplicate slashes and remove the last slash 
    497   if ($ENV{'GSDLOS'} =~ /^windows$/i) 
     497  if (($ENV{'GSDLOS'} =~ /^windows$/i) && ($^O ne "cygwin")) 
    498498  { 
    499499    $filename =~ s/[\\\/]+/\\/g; 
     
    509509} 
    510510## filenameConcatenate() 
     511 
     512 
     513 
     514## @function javaFilenameConcatenate() 
     515# 
     516# Same as filenameConcatenate(), except because on Cygwin 
     517# the java we run is still Windows native, then this means 
     518# we want the generate filename to be in native Windows format 
     519sub javaFilenameConcatenate 
     520{ 
     521  my (@filenames) = @_; 
     522 
     523  my $filename_cat = filenameConcatenate(@filenames); 
     524 
     525  if ($^O eq "cygwin") { 
     526      # java program, using a binary that is native to Windows, so need 
     527      # Windows directory and path separators 
     528 
     529      $filename_cat = `cygpath -wp "$filename_cat"`; 
     530      chomp($filename_cat); 
     531      $filename_cat =~ s%\\%\\\\%g; 
     532  } 
     533 
     534  return $filename_cat; 
     535} 
     536## javaFilenameConcatenate() 
     537 
    511538 
    512539## @function filePutContents() 
     
    553580  my $exists = 0; 
    554581 
    555   if ($ENV{'GSDLOS'} =~ m/^windows$/i) 
     582  if (($ENV{'GSDLOS'} =~ m/^windows$/i) && ($^O ne "cygwin")) 
    556583  { 
    557584    require Win32; 
     
    652679{ 
    653680  my ($filename) = @_; 
    654   if ($ENV{'GSDLOS'} =~ /^windows$/i) 
     681  if (($ENV{'GSDLOS'} =~ /^windows$/i) && ($^O ne "cygwin")) 
    655682  { 
    656683    return ($filename =~ m/^(\w:)?\\/); 
     
    11371164  } 
    11381165 
    1139   if ($ENV{'GSDLOS'} =~ /^windows$/i) 
     1166  if (($ENV{'GSDLOS'} =~ /^windows$/i) && ($^O ne "cygwin")) 
    11401167  { 
    11411168    # symlink not supported on windows