From 18e776fa2f9c3d304e06e492c5b5e6059add9bd8 Mon Sep 17 00:00:00 2001
From: Michael Gapczynski <GapczynskiM@gmail.com>
Date: Wed, 22 Jun 2011 11:40:09 -0400
Subject: [PATCH] Changed mount point to 'Share', fixed is_dir()

---
 apps/files_sharing/sharedstorage.php | 12 ++++++++++--
 lib/base.php                         |  3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index bf6116c9eb..4bb2ceb7c0 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -58,9 +58,14 @@ class OC_FILESTORAGE_SHARED {
 		}
 	}
 	
+	// TODO add all files from db in array
 	public function opendir($path) {
 		global $FAKEDIRS;
-		$FAKEDIRS['shared'] = array(0 => 'test.txt');
+		$sharedItems = OC_SHARE::getItemsSharedWith();
+		foreach ($sharedItems as $item) {
+			$files[] = $item['target'];
+		}
+		$FAKEDIRS['shared'] = $files;
 		return opendir('fakedir://shared');
 	}
 	
@@ -83,6 +88,8 @@ class OC_FILESTORAGE_SHARED {
 			return $storage->is_file(self::getInternalPath($source));
 		}
 	}
+	
+	// TODO fill in other components of array
 	public function stat($path) {
 		if ($path == "" || $path == "/") {
 			$stat["dev"] = "";
@@ -110,7 +117,7 @@ class OC_FILESTORAGE_SHARED {
 	
 	public function filetype($path) {
 		if ($path == "" || $path == "/") {
-			return "httpd/unix-directory";
+			return "dir";
 		} else {
 			$source = OC_SHARE::getSource($path);
 			if ($source) {
@@ -123,6 +130,7 @@ class OC_FILESTORAGE_SHARED {
 	
 	// TODO Get size of shared directory
 	public function filesize($path) {
+		echo "filesize";
 		if ($path == "" || $path == "/") {
 			return 10000;
 		} else {
diff --git a/lib/base.php b/lib/base.php
index 199653e25e..04f8f5c9fa 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -158,8 +158,9 @@ class OC_UTIL {
 // 			}
 			OC_FILESYSTEM::mount($rootStorage,'/');
 
+			// TODO add this storage provider in a proper way
 			$sharedStorage = OC_FILESYSTEM::createStorage('shared',array('datadir'=>$CONFIG_DATADIRECTORY));
-			OC_FILESYSTEM::mount($sharedStorage,'MTGap/files/Test/');
+			OC_FILESYSTEM::mount($sharedStorage,'MTGap/files/Share/');
 			
 			$CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root";
 			if( !is_dir( $CONFIG_DATADIRECTORY )){
-- 
GitLab