Working filebrowser in Windows
This commit is contained in:
@@ -16,7 +16,7 @@ class FileBrowser(Plugin):
|
||||
def getDirectories(self, path = '/', show_hidden = True):
|
||||
|
||||
# Return driveletters or root if path is empty
|
||||
if path == '/' or not path:
|
||||
if path == '/' or not path or path == '\\':
|
||||
if os.name == 'nt':
|
||||
return self.getDriveLetters()
|
||||
path = '/'
|
||||
@@ -25,7 +25,7 @@ class FileBrowser(Plugin):
|
||||
for f in os.listdir(path):
|
||||
p = os.path.join(path, f)
|
||||
if os.path.isdir(p) and ((self.is_hidden(p) and bool(int(show_hidden))) or not self.is_hidden(p)):
|
||||
dirs.append(p + '/')
|
||||
dirs.append(p + os.path.sep)
|
||||
|
||||
return dirs
|
||||
|
||||
@@ -37,7 +37,7 @@ class FileBrowser(Plugin):
|
||||
driveletters = []
|
||||
for drive in string.ascii_uppercase:
|
||||
if win32file.GetDriveType(drive + ":") == win32file.DRIVE_FIXED:
|
||||
driveletters.append(drive + ":")
|
||||
driveletters.append(drive + ":\\")
|
||||
|
||||
return driveletters
|
||||
|
||||
|
||||
@@ -604,7 +604,7 @@ Option.Directory = new Class({
|
||||
var v = self.input.get('text');
|
||||
var previous_dir = self.getParentDir();
|
||||
|
||||
if(previous_dir != v){
|
||||
if(previous_dir != v && previous_dir.length > 1){
|
||||
self.back_button.set('data-value', previous_dir)
|
||||
self.back_button.set('html', '« '+self.getCurrentDirname(previous_dir))
|
||||
self.back_button.show()
|
||||
@@ -668,7 +668,7 @@ Option.Directory = new Class({
|
||||
|
||||
var dir_split = dir.split(Api.getOption('path_sep'));
|
||||
|
||||
return dir_split[dir_split.length-2] || '/'
|
||||
return dir_split[dir_split.length-2] || Api.getOption('path_sep')
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
|
||||
Reference in New Issue
Block a user