mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Don't raise errors if directories don't exist
This commit is contained in:
parent
11c9541b53
commit
4757fac383
1 changed files with 12 additions and 6 deletions
|
|
@ -50,12 +50,18 @@ class FilesystemStorage(Storage):
|
|||
if kwargs.pop('collection', None) is not None:
|
||||
raise TypeError('collection argument must not be given.')
|
||||
path = expand_path(path)
|
||||
for collection in os.listdir(path):
|
||||
collection_path = os.path.join(path, collection)
|
||||
if os.path.isdir(collection_path):
|
||||
args = dict(collection=collection, path=collection_path,
|
||||
**kwargs)
|
||||
yield args
|
||||
try:
|
||||
collections = os.listdir(path)
|
||||
except OSError:
|
||||
if not kwargs.get('create', True):
|
||||
raise
|
||||
else:
|
||||
for collection in collections:
|
||||
collection_path = os.path.join(path, collection)
|
||||
if os.path.isdir(collection_path):
|
||||
args = dict(collection=collection, path=collection_path,
|
||||
**kwargs)
|
||||
yield args
|
||||
|
||||
@classmethod
|
||||
def join_collection(cls, collection, **kwargs):
|
||||
|
|
|
|||
Loading…
Reference in a new issue