Simplify relative path handling.
--HG-- extra : rebase_source : d20290cad2dca3ea1f04a85f899c026c0991bbe5
This commit is contained in:
parent
881f76d87a
commit
30f801443e
2 changed files with 27 additions and 11 deletions
|
@ -153,9 +153,9 @@ class EPub {
|
|||
/**
|
||||
* Get the component content
|
||||
*/
|
||||
public function component($comp, $elementPath) {
|
||||
public function component($comp) {
|
||||
$path = str_replace ("-SLASH-", "/", $comp);
|
||||
$path = $this->getFullPath ($path, $elementPath);
|
||||
$path = $this->getFullPath ($path);
|
||||
if (!$this->zip->FileExists($path)) {
|
||||
throw new Exception ("Unable to find " . $path);
|
||||
}
|
||||
|
@ -164,6 +164,15 @@ class EPub {
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function getComponentName ($comp, $elementPath) {
|
||||
$path = str_replace ("-SLASH-", "/", $comp);
|
||||
$path = $this->getFullPath ($path, $elementPath);
|
||||
if (!$this->zip->FileExists($path)) {
|
||||
throw new Exception ("Unable to find " . $path);
|
||||
}
|
||||
return str_replace ("/", "-SLASH-", $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the component content type
|
||||
*/
|
||||
|
@ -533,7 +542,7 @@ class EPub {
|
|||
if (!empty ($context)) {
|
||||
$path = $this->combine (dirname ($path), $context);
|
||||
}
|
||||
error_log ("FullPath : $path ($file / $context)");
|
||||
//error_log ("FullPath : $path ($file / $context)");
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue