#42 template.inc and Windows abs paths

closed-accepted
None
5
2004-04-21
2003-02-08
No

The filepath() method currently checks for absolute
paths by testing for an initial '/'. This fails on
Windows when the filepath includes a drive letter.

The revised method looks like this:

function filename($filename) {
if ($this->debug & 4) {
echo "<p><b>filename:</b> filename =
$filename</p>\n";
}
if (substr($filename, 0, 1) != "/" &&
substr($filename, 1, 1) != ":") { // Test for Unix or
Windows absolute path
$filename = $this->root."/".$filename;
}

if (!file_exists($filename)) {
$this->halt("filename: file $filename does not
exist.");
}
return $filename;
}

Discussion

  • Richard Archer

    Richard Archer - 2004-04-21
    • status: open --> closed
     
  • Richard Archer

    Richard Archer - 2004-04-21

    Logged In: YES
    user_id=279311

    Thank you!

     
  • Richard Archer

    Richard Archer - 2004-04-21
    • assigned_to: nobody --> richardarcher
    • status: closed --> closed-accepted
     

Log in to post a comment.