mirror of https://github.com/kivy/kivy.git
filechooser: Fix a crash when using a file as the path
This commit is contained in:
parent
feefbaaeb0
commit
35fbac92fc
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue