Add comment discussing why why use the temporary directory
This commit is contained in:
parent
4cd058710a
commit
9d6352ce78
1 changed files with 5 additions and 2 deletions
|
|
@ -15,13 +15,16 @@ case "$@" in -h|--help) usage && exit 0;; esac
|
||||||
[ -z "$gpx_directory" ] && usage && exit 1
|
[ -z "$gpx_directory" ] && usage && exit 1
|
||||||
[ -z "$target_database" ] && usage && exit 1
|
[ -z "$target_database" ] && usage && exit 1
|
||||||
|
|
||||||
tmp="$(mktemp -d diogenes.XXXXX -p /tmp)/$(basename $target_database)"
|
# we write to a temporary location to make the replace option atomic (if on the same device)
|
||||||
|
tmp_dir="$(mktemp -d diogenes.XXXXX -p /tmp)"
|
||||||
|
tmp="$tmp_dir/$(basename $target_database)"
|
||||||
|
|
||||||
# recursive scan and import
|
# recursive scan and import
|
||||||
while IFS= read -d '' -r file; do
|
while IFS= read -d '' -r file; do
|
||||||
spatialite_xml_load -d "$tmp" -x "$file"
|
spatialite_xml_load -d "$tmp" -x "$file"
|
||||||
done < <(find "$gpx_directory" -name '*.gpx' -print0)
|
done < <(find "$gpx_directory" -name '*.gpx' -print0)
|
||||||
|
|
||||||
mv $tmp $target_database
|
mv -f "$tmp" "$target_database"
|
||||||
|
rm -rf "$tmp_dir"
|
||||||
|
|
||||||
# TODO: Create virtual joined table
|
# TODO: Create virtual joined table
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue