Skip to content

Commit d4bd1da

Browse files
author
Alexander Getmansky
committed
fixed #100 : All basename are replaced.
1 parent cc70d16 commit d4bd1da

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/Adapter/AbstractAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,6 @@ private function makeTargetAbsolute($path)
246246
throw new InvalidArgumentException(sprintf('Target path %s is not writeable.', $directory));
247247
}
248248

249-
return realpath($directory).'/'.basename ($path);
249+
return realpath($directory).'/'.substr($path, strrpos(str_replace('\\', '/', $path), '/') + 1);
250250
}
251251
}

src/Resource/Resource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getContextForProcessInSinglePlace()
8787
return null;
8888
}
8989

90-
if (basename($this->original) === $this->target) {
90+
if (substr($this->original, strrpos(str_replace('\\', '/', $this->original), '/') + 1) === $this->target) {
9191
return dirname($this->original);
9292
}
9393
}

src/Resource/TargetLocator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function locateResource($resource)
6060
throw new TargetLocatorException($resource, 'Unable to retrieve path from resource');
6161
}
6262

63-
return basename($data['path']);
63+
return substr($data['path'], strrpos(str_replace('\\', '/', $data['path']), '/') + 1);
6464
}
6565

6666
/**
@@ -86,7 +86,7 @@ private function locateString($context, $resource)
8686
return $this->getRelativePathFromContext($url['path'], $context);
8787
}
8888

89-
return basename($resource);
89+
return substr($resource, strrpos(str_replace('\\', '/', $resource), '/') + 1);
9090
}
9191

9292
// resource is a local path
@@ -95,7 +95,7 @@ private function locateString($context, $resource)
9595

9696
return $this->getRelativePathFromContext($resource, $context);
9797
} else {
98-
return basename($resource);
98+
return substr($resource, strrpos(str_replace('\\', '/', $resource), '/') + 1);
9999
}
100100
}
101101

tests/Tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,6 @@ protected function getExpectedAbsolutePathForTarget($target)
120120
throw new \InvalidArgumentException(sprintf('Unable to get the absolute path for %s', $target));
121121
}
122122

123-
return realpath($directory).'/'.basename($target);
123+
return realpath($directory).'/'.substr($target, strrpos(str_replace('\\', '/', $target), '/') + 1);
124124
}
125125
}

0 commit comments

Comments
 (0)