Browse files

fixed Dropbox VFS

  • Loading branch information...
1 parent 625de8f commit 7e703ca08cad3c162b16a8ce8b2a5bb31c3265f9 @robweber committed Mar 4, 2013
Showing with 11 additions and 6 deletions.
  1. +11 −6 resources/lib/vfs.py
View
17 resources/lib/vfs.py
@@ -11,9 +11,6 @@
class Vfs:
root_path = None
- def __init(self):
- pass
-
def __init__(self,rootString):
self.set_root(rootString)
@@ -70,8 +67,8 @@ class DropboxFileSystem(Vfs):
client = None
def __init__(self,rootString):
+ self.set_root(rootString)
self.setup()
- Vfs.__init__(rootString)
def setup(self):
if(APP_KEY == '' or APP_SECRET == ''):
@@ -123,6 +120,7 @@ def listdir(self,directory):
def mkdir(self,directory):
+ directory = self._fix_slashes(directory)
if(self.client != None):
if(not self.exists(directory)):
self.client.file_create_folder(directory)
@@ -131,12 +129,14 @@ def mkdir(self,directory):
return False
def rmdir(self,directory):
+ directory = self._fix_slashes(directory)
if(self.client != None and self.exists(directory)):
self.client.file_delete(directory)
else:
return False
def exists(self,aFile):
+ aFile = self._fix_slashes(aFile)
if(self.client != None):
try:
meta_data = self.client.metadata(aFile)
@@ -147,7 +147,9 @@ def exists(self,aFile):
else:
return False
- def put(self,source,dest):
+ def put(self,source,dest):
+ dest = self._fix_slashes(dest)
+
if(self.client != None):
f = open(source,'rb')
try:
@@ -169,7 +171,10 @@ def get_file(self,source,dest):
out.close()
else:
return False
-
+
+ def _fix_slashes(self,filename):
+ return filename.replace('\\','/')
+
def setToken(self,key,secret):
#write the token files
token_file = open(xbmc.translatePath(utils.data_dir() + "tokens.txt"),'w')

0 comments on commit 7e703ca

Please sign in to comment.