From 4e10e30c2f99d552239871aa1b27a08a6c18f1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 5 Jun 2016 04:23:39 +0200 Subject: Imported Upstream version 0.23.1 --- src/main.vala | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/main.vala') diff --git a/src/main.vala b/src/main.vala index 6a705a7..2df29ed 100644 --- a/src/main.vala +++ b/src/main.vala @@ -1,4 +1,4 @@ -/* Copyright 2009-2015 Yorba Foundation +/* Copyright 2016 Software Freedom Conservancy Inc. * * This software is licensed under the GNU LGPL (version 2.1 or later). * See the COPYING file in this distribution. @@ -433,9 +433,17 @@ void main(string[] args) { if (is_string_empty(filename) && !was_already_running) { string orig_path = AppDirs.get_data_subdir("data").get_child("photo.db").get_path(); string backup_path = orig_path + ".bak"; - string cmdline = "cp " + orig_path + " " + backup_path; - Posix.system(cmdline); - Posix.system("sync"); + try { + File src = File.new_for_commandline_arg(orig_path); + File dest = File.new_for_commandline_arg(backup_path); + src.copy(dest, + FileCopyFlags.OVERWRITE | + FileCopyFlags.ALL_METADATA); + } catch(Error error) { + warning("Failed to create backup file of database: %s", + error.message); + } + Posix.sync(); } } -- cgit v1.2.3