Skip to content

Commit

Permalink
Add pre 3.20 compatibility to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Aug 21, 2024
1 parent 8cb61f2 commit 5e61fa3
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions libqfieldsync/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,14 +1138,22 @@ def convert_to_gpkg(self, target_path):
options = QgsVectorFileWriter.SaveVectorOptions()
options.fileEncoding = "UTF-8"
options.driverName = "GPKG"
(
error,
error_msg,
returned_dest_file,
returned_dest_layer,
) = QgsVectorFileWriter.writeAsVectorFormatV3(
source_layer, dest_file, QgsCoordinateTransformContext(), options
)
if Qgis.QGIS_VERSION_INT > 32000:
(
error,
error_msg,
returned_dest_file,
returned_dest_layer,
) = QgsVectorFileWriter.writeAsVectorFormatV3(
source_layer, dest_file, QgsCoordinateTransformContext(), options
)
else:
(
error,
returned_dest_file,
) = QgsVectorFileWriter.writeAsVectorFormatV2(
source_layer, dest_file, QgsCoordinateTransformContext(), options
)
if error != QgsVectorFileWriter.NoError:
return
if returned_dest_file:
Expand Down

0 comments on commit 5e61fa3

Please sign in to comment.