Skip to content
Snippets Groups Projects
Commit 6ba23912 authored by Thomas Tanghus's avatar Thomas Tanghus
Browse files

Add getUserFolder/getAppFolder to Server.

parent 415a27c1
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,20 @@ interface IServerContainer {
*/
function getRootFolder();
/**
* Returns a view to ownCloud's files folder
*
* @return \OCP\Files\Folder
*/
function getUserFolder();
/**
* Returns an app-specific view in ownClouds data directory
*
* @return \OCP\Files\Folder
*/
function getAppFolder();
/**
* Returns the current session
*
......
......@@ -56,6 +56,17 @@ class Server extends SimpleContainer implements IServerContainer {
$view = new View();
return new Root($manager, $view, $user);
});
$this->registerService('CustomFolder', function($c) {
$dir = $c['CustomFolderPath'];
$root = $this->getRootFolder();
$folder = null;
if(!$root->nodeExists($dir)) {
$folder = $root->newFolder($dir);
} else {
$folder = $root->get($dir);
}
return $folder;
});
}
/**
......@@ -97,6 +108,30 @@ class Server extends SimpleContainer implements IServerContainer {
return $this->query('RootFolder');
}
/**
* Returns a view to ownCloud's files folder
*
* @return \OCP\Files\Folder
*/
function getUserFolder() {
$this->registerParameter('CustomFolderPath', '/files');
return $this->query('CustomFolder');
}
/**
* Returns an app-specific view in ownClouds data directory
*
* @return \OCP\Files\Folder
*/
function getAppFolder() {
$this->registerParameter('CustomFolderPath', '/' . \OC_App::getCurrentApp());
return $this->query('CustomFolder');
}
/**
* Returns the current session
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment