Skip to content

Commit

Permalink
fix keep existent
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 4, 2019
1 parent 86431ce commit 765e5d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions qfieldsync/core/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,11 @@ def copy(self, target_path, copied_files, keep_existent=False):
source_path, file_name = os.path.split(file_path)
basename, extensions = get_file_extension_group(file_name)
for ext in extensions:
if os.path.exists(os.path.join(source_path, basename + ext)):
dest_file = os.path.join(target_path, basename + ext)
if os.path.exists(os.path.join(source_path, basename + ext)) and \
(keep_existent is False or not os.path.isfile(dest_file)):
shutil.copy(os.path.join(source_path, basename + ext),
os.path.join(target_path, basename + ext))
dest_file)
uri.setDatabase(os.path.join(target_path, file_name))
self._change_data_source(uri.uri())
return copied_files
Expand Down
2 changes: 1 addition & 1 deletion qfieldsync/core/offline_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def convert(self):
elif layer_source.action == SyncAction.NO_ACTION:
copied_files = layer_source.copy(self.export_folder, copied_files)
elif layer_source.action == SyncAction.KEEP_EXISTENT:
layer_source.copy(self.export_folder, True)
layer_source.copy(self.export_folder, copied_files, True)
elif layer_source.action == SyncAction.REMOVE:
project.removeMapLayer(layer)

Expand Down

0 comments on commit 765e5d0

Please sign in to comment.