Changeset 13788
- Timestamp:
- Jun 13, 2007, 9:16:11 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
r13724 r13788 1 1 # Copyright (c) 2006 Paul Price, Joshua Hoblitt 2 2 # 3 # $Id: Config.pm,v 1. 59 2007-06-08 22:53:39eugene Exp $3 # $Id: Config.pm,v 1.60 2007-06-13 19:16:11 eugene Exp $ 4 4 5 5 package PS::IPP::Config; … … 281 281 } 282 282 if ($scheme eq 'path' or $scheme eq 'file') { 283 # guaranteed to have a scheme (path:// or file://) 283 284 return $self->convert_filename_absolute( $name ); 284 285 } … … 304 305 } 305 306 if ($scheme eq 'path' or $scheme eq 'file') { 307 # guaranteed to have a scheme (path:// or file://) 306 308 $name = $self->convert_filename_absolute( $name ); 307 309 } … … 338 340 } 339 341 if ($scheme eq 'path' or $scheme eq 'file') { 342 # guaranteed to have a scheme (path:// or file://) 340 343 $name = $self->convert_filename_absolute( $name ); 341 344 } … … 436 439 437 440 # Might need to create a directory 441 # not guaranteed to have a scheme (path:// or file://) - might be /PATH/foobar 442 # a relative path (PATH/foobar) is invalid here 438 443 my $resolved = $self->convert_filename_absolute( $name ); 439 444 my ( $vol, $dirs, $file ) = File::Spec->splitpath( $resolved ); … … 447 452 448 453 # Convert a relative filename (e.g., "path://PATH/file") to an absolute (e.g., "/path/to/file") 454 # note that file://PATH/file resolves to /PATH/file, regardless of the number of leading slashes 449 455 sub convert_filename_absolute 450 456 { … … 457 463 } 458 464 459 $name =~ s|/$||; 465 $name =~ s|/$||; # drop tailing slashes (foobar/ to foobar) 460 466 my ($scheme) = $name =~ m|^(\S+):|; # The scheme, e.g., file, path 467 468 ## if this is already an absolute path (/PATH/file), just return the path 469 unless (defined $scheme) { 470 if ($name =~ m|^/|) { return $name; } 471 # without a leading slash, this is an error 472 carp "Programming error"; 473 exit($PS_EXIT_PROG_ERROR); 474 } 475 461 476 $name =~ s|^\S+:/*||; 462 return $name if lc($scheme) eq 'file'; 477 $name = '/' . $name; 478 479 if (lc($scheme) eq 'file') { 480 return $name; 481 } 463 482 464 483 if (lc($scheme) eq 'path') { … … 470 489 } 471 490 472 return $name; 491 # looks like we cannot reach here without an invalid scheme. 492 # programming error? 493 # return $name; 494 495 carp "Programming error"; 496 exit($PS_EXIT_PROG_ERROR); 473 497 } 474 498 … … 490 514 if ($scheme eq 'path' or $scheme eq 'file') { 491 515 # We may as well search for a 'better' path 516 # guaranteed to have a scheme (path:// or file://) 492 517 $name = $self->convert_filename_absolute( $name ); 493 518 } elsif ($scheme eq 'neb') {
Note:
See TracChangeset
for help on using the changeset viewer.
