From fb46daaca484981be23f3700b16f546bbd9c67a6 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Wed, 16 Mar 2022 14:36:40 +0200 Subject: [PATCH] Ignore all files starting with leading dot (.) or ending in tilde (~) --- src/qfieldcloud_sdk/sdk.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qfieldcloud_sdk/sdk.py b/src/qfieldcloud_sdk/sdk.py index 57db3ab..15bbfa7 100644 --- a/src/qfieldcloud_sdk/sdk.py +++ b/src/qfieldcloud_sdk/sdk.py @@ -598,7 +598,7 @@ def list_local_files( ) -> List[Dict[str, Any]]: """ Returns a list of dicts with information about local files. Usually used before uploading files. - NOTE: files and dirs starting with leading zero in the root directory will be ignored. + NOTE: files and dirs starting with leading dot (.) or ending in tilde (~) will be ignored. """ if not filter_glob: filter_glob = "*" @@ -608,7 +608,8 @@ def list_local_files( if not path.is_file(): continue - if str(path.relative_to(root_path)).startswith("."): + basename = path.relative_to(root_path).name + if basename.startswith(".") or basename.endswith("~"): continue relative_name = path.relative_to(root_path)