[fs] adds a defaut to current working directory in open_fs(...).

This commit is contained in:
Romain Dorgueil
2017-06-17 10:08:06 +02:00
parent 8c898afc27
commit a65ca635cf

View File

@ -68,7 +68,7 @@ register_api(create_strategy)
# Shortcut to filesystem2's open_fs, that we make available there for convenience.
@register_api
def open_fs(fs_url, *args, **kwargs):
def open_fs(fs_url=None, *args, **kwargs):
"""
Wraps :func:`fs.open_fs` function with a few candies.
@ -83,6 +83,10 @@ def open_fs(fs_url, *args, **kwargs):
"""
from fs import open_fs as _open_fs
from os.path import expanduser
from os import getcwd
if fs_url is None:
fs_url = getcwd()
return _open_fs(expanduser(str(fs_url)), *args, **kwargs)