From 24748ee10fb6d165f51a3c99277a22106787696c Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Wed, 8 Feb 2012 21:01:09 +0100
Subject: [PATCH] add convinience function to get filesystem view for app
 storage

---
 lib/app.php | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/app.php b/lib/app.php
index 37a99823e3..22d18b17ee 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -403,4 +403,22 @@ class OC_App{
 			include OC::$SERVERROOT.'/apps/'.$appid.'/appinfo/update.php';
 		}
 	}
+
+	/**
+	 * @param string appid
+	 * @return OC_FilesystemView
+	 */
+	public static function getStorage($appid){
+		if(OC_App::isEnabled($appid)){//sanity check
+			if(OC_User::isLoggedIn()){
+				return new OC_FilesystemView('/'.OC_User::getUser().'/'.$appid);
+			}else{
+				OC_Log::write('core','Can\'t get app storage, app, user not logged in',OC_Log::ERROR);
+				return false;
+			}
+		}else{
+			OC_Log::write('core','Can\'t get app storage, app '.$appid.' not enabled',OC_Log::ERROR);
+			false;
+		}
+	}
 }
-- 
GitLab