mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
slight changes so mkdir works
This commit is contained in:
parent
cf40edad79
commit
e90c8e7803
@ -312,7 +312,7 @@ class GoogleDriveFilesystem(Vfs):
|
|||||||
|
|
||||||
#make sure we have the folder we need
|
#make sure we have the folder we need
|
||||||
xbmc_folder = self._getGoogleFile(self.root_path)
|
xbmc_folder = self._getGoogleFile(self.root_path)
|
||||||
|
print xbmc_folder
|
||||||
if(xbmc_folder == None):
|
if(xbmc_folder == None):
|
||||||
self.mkdir(self.root_path)
|
self.mkdir(self.root_path)
|
||||||
|
|
||||||
@ -350,10 +350,14 @@ class GoogleDriveFilesystem(Vfs):
|
|||||||
if(not directory.startswith('/')):
|
if(not directory.startswith('/')):
|
||||||
directory = '/' + directory
|
directory = '/' + directory
|
||||||
|
|
||||||
|
if(directory.endswith('/')):
|
||||||
|
directory = directory[:-1]
|
||||||
|
|
||||||
#split the string by the directory separator
|
#split the string by the directory separator
|
||||||
pathList = os.path.split(directory)
|
pathList = os.path.split(directory)
|
||||||
|
|
||||||
if(pathList[0] == '/'):
|
if(pathList[0] == '/'):
|
||||||
|
|
||||||
#we're at the root, just make the folder
|
#we're at the root, just make the folder
|
||||||
newFolder = self.drive.CreateFile({'title': pathList[1], 'parent':'root','mimeType':self.FOLDER_TYPE})
|
newFolder = self.drive.CreateFile({'title': pathList[1], 'parent':'root','mimeType':self.FOLDER_TYPE})
|
||||||
newFolder.Upload()
|
newFolder.Upload()
|
||||||
@ -362,7 +366,7 @@ class GoogleDriveFilesystem(Vfs):
|
|||||||
parentFolder = self._getGoogleFile(pathList[0])
|
parentFolder = self._getGoogleFile(pathList[0])
|
||||||
|
|
||||||
if(parentFolder != None):
|
if(parentFolder != None):
|
||||||
newFolder = self.drive.CreateFile({'title': pathList[1], 'parent':parentFolder['id'],'mimeType':self.FOLDER_TYPE})
|
newFolder = self.drive.CreateFile({'title': pathList[1],"parents":[{'kind':'drive#fileLink','id':parentFolder['id']}],'mimeType':self.FOLDER_TYPE})
|
||||||
newFolder.Upload()
|
newFolder.Upload()
|
||||||
else:
|
else:
|
||||||
result = False
|
result = False
|
||||||
@ -431,7 +435,7 @@ class GoogleDriveFilesystem(Vfs):
|
|||||||
|
|
||||||
def _getGoogleFile(self,file):
|
def _getGoogleFile(self,file):
|
||||||
result = None
|
result = None
|
||||||
utils.log(file)
|
|
||||||
#file must start with / and not end with one (even directory)
|
#file must start with / and not end with one (even directory)
|
||||||
if(not file.startswith('/')):
|
if(not file.startswith('/')):
|
||||||
file = '/' + file
|
file = '/' + file
|
||||||
@ -439,8 +443,8 @@ class GoogleDriveFilesystem(Vfs):
|
|||||||
if(file.endswith('/')):
|
if(file.endswith('/')):
|
||||||
file = file[:-1]
|
file = file[:-1]
|
||||||
|
|
||||||
if(self.history[file] != None):
|
if(self.history.has_key(file)):
|
||||||
utils.log('used history')
|
|
||||||
result = self.history[file]
|
result = self.history[file]
|
||||||
else:
|
else:
|
||||||
pathList = os.path.split(file)
|
pathList = os.path.split(file)
|
||||||
@ -457,7 +461,7 @@ class GoogleDriveFilesystem(Vfs):
|
|||||||
#recurse down the tree
|
#recurse down the tree
|
||||||
current_file = pathList[1]
|
current_file = pathList[1]
|
||||||
|
|
||||||
parentId = self.getGoogleFile(pathList[0])
|
parentId = self._getGoogleFile(pathList[0])
|
||||||
|
|
||||||
if(parentId != None):
|
if(parentId != None):
|
||||||
self.history[pathList[0]] = parentId
|
self.history[pathList[0]] = parentId
|
||||||
|
Loading…
Reference in New Issue
Block a user