Skip to content
Snippets Groups Projects
Commit 68f65b65 authored by Robin Appelman's avatar Robin Appelman
Browse files

add OC_Filesystem::resolvePath to get the storage backend and internal path for a file in one go

parent e8d3a476
Branches
No related tags found
No related merge requests found
......@@ -194,6 +194,24 @@ class OC_Filesystem{
}
}
/**
* resolve a path to a storage and internal path
* @param string $path
* @return array consisting of the storage and the internal path
*/
static public function resolvePath($path){
$mountpoint=self::getMountPoint($path);
if($mountpoint) {
if(!isset(OC_Filesystem::$storages[$mountpoint])) {
$mount=OC_Filesystem::$mounts[$mountpoint];
OC_Filesystem::$storages[$mountpoint]=OC_Filesystem::createStorage($mount['class'],$mount['arguments']);
}
$storage = OC_Filesystem::$storages[$mountpoint];
$internalPath=substr($path,strlen($mountpoint));
return array($storage, $internalPath);
}
}
static public function init($root) {
if(self::$defaultInstance) {
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment