filechooser: Fix a crash when using a file as the path

This commit is contained in:
ZingBallyhoo 2017-02-21 19:56:52 +00:00 committed by matham
parent feefbaaeb0
commit 35fbac92fc
1 changed files with 3 additions and 1 deletions

View File

@ -102,7 +102,7 @@ from kivy.properties import (
from os import listdir from os import listdir
from os.path import ( from os.path import (
basename, join, sep, normpath, expanduser, altsep, basename, join, sep, normpath, expanduser, altsep,
splitdrive, realpath, getsize, isdir, abspath) splitdrive, realpath, getsize, isdir, abspath, isfile, dirname)
from fnmatch import fnmatch from fnmatch import fnmatch
import collections import collections
@ -838,6 +838,8 @@ class FileChooserController(RelativeLayout):
def _add_files(self, path, parent=None): def _add_files(self, path, parent=None):
path = expanduser(path) path = expanduser(path)
if isfile(path):
path = dirname(path)
files = [] files = []
fappend = files.append fappend = files.append