mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Module->getResourcePath()
Based on Sam's feedback in https://github.com/silverstripe/silverstripe-framework/pull/6733
This commit is contained in:
parent
874c6ccdd4
commit
556c9a537e
@ -161,7 +161,7 @@ class Module implements Serializable
|
||||
* @param string $path File or directory path relative to module directory
|
||||
* @return string Path relative to base directory
|
||||
*/
|
||||
public function getResource($path)
|
||||
public function getResourcePath($path)
|
||||
{
|
||||
return File::join_paths($this->getRelativePath(), $path);
|
||||
}
|
||||
@ -175,7 +175,7 @@ class Module implements Serializable
|
||||
*/
|
||||
public function hasResource($path)
|
||||
{
|
||||
$resource = $this->getResource($path);
|
||||
$resource = $this->getResourcePath($path);
|
||||
return file_exists($this->basePath . '/' . $resource);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class ModuleManifestTest extends SapphireTest
|
||||
$this->assertFalse($module->hasResource('package.json'));
|
||||
$this->assertEquals(
|
||||
'moduleb/composer.json',
|
||||
$module->getResource('composer.json')
|
||||
$module->getResourcePath('composer.json')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user