Changeset 28395


Ignore:
Timestamp:
10/14/13 09:59:05 (8 years ago)
Author:
davidb
Message:

Support for running under Cygwin added

Location:
main/trunk/greenstone2/perllib/dbutil
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/dbutil/gdbm.pm

    r27306 r28395  
    105105  while (defined ($infodb_line = <PIPEIN>))
    106106  {
     107    $infodb_line =~ s/(\r\n)+$//; # more general than chomp
     108
    107109    if ($infodb_line =~ /^\[([^\]]+)\]$/)
    108110    {
     
    139141  while (defined ($infodb_line = <PIPEIN>))
    140142  {
    141       chomp $infodb_line; # remove end of line
     143      # chomp $infodb_line; # remove end of line
     144      $infodb_line =~ s/(\r\n)+$//; # more general than chomp
    142145
    143146      $infodb_map->{$infodb_line} = 1;
  • main/trunk/greenstone2/perllib/dbutil/gdbmtxtgz.pm

    r27602 r28395  
    9696  while (defined ($infodb_line = <PIPEIN>))
    9797  {
     98    $infodb_line =~ s/(\r\n)+$//; # more general than chomp
     99
    98100    if ($infodb_line =~ /^\[([^\]]+)\]$/)
    99101    {
     
    131133  while (defined ($infodb_line = <PIPEIN>))
    132134  {
     135    $infodb_line =~ s/(\r\n)+$//; # more general than chomp
     136
    133137    if ($infodb_line =~ /^\[([^\]]+)\]$/)
    134138    {
  • main/trunk/greenstone2/perllib/dbutil/jdbm.pm

    r28126 r28395  
    5050  my $classpath = &util::pathname_cat($jdbmwrap_jar,$jdbm_jar);
    5151
     52  if ($^O eq "cygwin") {
     53      # Away to run a java program, using a binary that is native to Windows, so need
     54      # Windows directory and path separators
     55
     56      $classpath = `cygpath -wp "$classpath"`;
     57      chomp($classpath);
     58      $classpath =~ s%\\%\\\\%g;
     59  }
     60
    5261  my $infodb_file_handle = undef;
    5362  my $txt2jdb_cmd = "java -cp \"$classpath\" Txt2Jdb";
     
    6473  $infodb_file_path =~ s/\.jdb$//;
    6574
     75  if ($^O eq "cygwin") {
     76      $infodb_file_path = `cygpath -w "$infodb_file_path"`;
     77      chomp($infodb_file_path);
     78      $infodb_file_path =~ s%\\%\\\\%g;
     79  }
     80
    6681  $txt2jdb_cmd .= " \"$infodb_file_path\"";
    67 
    68 ##  print STDERR "**** txt2jdbm cmd = $txt2jdb_cmd\n\n";
    6982
    7083  if (!open($infodb_file_handle, "| $txt2jdb_cmd"))
     
    109122
    110123  my $classpath = &util::pathname_cat($jdbmwrap_jar,$jdbm_jar);
     124
     125  if ($^O eq "cygwin") {
     126      # Away to run a java program, using a binary that is native to Windows, so need
     127      # Windows directory and path separators
     128     
     129      $classpath = `cygpath -wp "$classpath"`;
     130      chomp($classpath);
     131      $classpath =~ s%\\%\\\\%g;
     132
     133      $infodb_file_path = `cygpath -w "$infodb_file_path"`;
     134      chomp($infodb_file_path);
     135      $infodb_file_path =~ s%\\%\\\\%g;
     136  }
    111137
    112138  my $jdb2txt_cmd = "java -cp \"$classpath\" Jdb2Txt";
     
    119145  while (defined ($infodb_line = <PIPEIN>))
    120146  {
     147    $infodb_line =~ s/(\r\n)+$//; # more general than chomp
     148
    121149    if ($infodb_line =~ /^\[([^\]]+)\]$/)
    122150    {
     
    157185  while (defined ($infodb_line = <PIPEIN>))
    158186  {
    159       chomp $infodb_line; # remove end of line
     187      # chomp $infodb_line; # remove end of line
     188      $infodb_line =~ s/(\r\n)+$//; # more general than chomp
    160189
    161190      $infodb_map->{$infodb_line} = 1;
     
    173202  my $infodb_key = shift(@_);
    174203  my $infodb_map = shift(@_);
    175  
     204
    176205  print $infodb_handle "[$infodb_key]\n";
    177206  foreach my $infodb_value_key (keys(%$infodb_map))
     
    240269    $infodb_file_path =~ s/\.jdb$//;
    241270
     271    if ($^O eq "cygwin") {
     272    # Away to run a java program, using a binary that is native to Windows, so need
     273    # Windows directory and path separators
     274   
     275      $classpath = `cygpath -wp "$classpath"`;
     276      chomp($classpath);
     277      $classpath =~ s%\\%\\\\%g;
     278
     279      $infodb_file_path = `cygpath -w "$infodb_file_path"`;
     280      chomp($infodb_file_path);
     281      $infodb_file_path =~ s%\\%\\\\%g;
     282    }
     283
    242284    my $cmd = "java -cp \"$classpath\" Txt2Jdb -append \"$infodb_file_path\"";
    243285
Note: See TracChangeset for help on using the changeset viewer.