diff options
Diffstat (limited to 'src/db/DatabaseTable.vala')
-rw-r--r-- | src/db/DatabaseTable.vala | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/db/DatabaseTable.vala b/src/db/DatabaseTable.vala index 235ac06..42eac69 100644 --- a/src/db/DatabaseTable.vala +++ b/src/db/DatabaseTable.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. @@ -69,10 +69,17 @@ public abstract class DatabaseTable { db = null; string backup_path = filename + ".bak"; - string cmdline = "cp " + backup_path + " " + filename; - Posix.system(cmdline); - prepare_db(filename); + try { + File src = File.new_for_commandline_arg(backup_path); + File dest = File.new_for_commandline_arg(filename); + src.copy(dest, + FileCopyFlags.OVERWRITE | + FileCopyFlags.ALL_METADATA); + prepare_db(filename); + } catch (Error error) { + AppWindow.panic(_("Unable to restore photo database %s").printf(error.message)); + } } // disable synchronized commits for performance reasons ... this is not vital, hence we |