Commit 456194a1 authored by Michael Terry's avatar Michael Terry

re-examine whether the backup location is a volume each backup -- this will...

re-examine whether the backup location is a volume each backup -- this will help us detect when a user manually enters a volume path
parent a2f44282
......@@ -198,8 +198,6 @@ public class BackendFile : Backend
{
var settings = get_settings(FILE_ROOT);
get_settings().set_string(BACKEND_KEY, "file");
if (!file.is_native()) {
settings.set_string(FILE_TYPE_KEY, "normal");
return;
......@@ -229,13 +227,11 @@ public class BackendFile : Backend
relpath = "";
}
set_volume_info(volume, relpath);
yield set_volume_info(volume, relpath);
}
public async static void set_volume_info(Volume volume, string? relpath = null)
{
get_settings().set_string(BACKEND_KEY, "file");
var uuid = volume.get_identifier(VOLUME_IDENTIFIER_KIND_UUID);
if (uuid == null || uuid == "")
return;
......@@ -246,9 +242,8 @@ public class BackendFile : Backend
settings.set_string(FILE_UUID_KEY, uuid);
if (relpath != null)
settings.set_value(FILE_RELPATH_KEY, new Variant.bytestring(relpath));
settings.apply();
update_volume_info(volume);
settings.apply();
}
static void update_volume_info(Volume volume)
......@@ -338,19 +333,19 @@ public class BackendFile : Backend
throw err; // continue error on
}
var gfile = get_file_from_settings();
if (success) {
var gfile = get_file_from_settings();
// If we don't know what type this is, look up volume data
if (type != "volume" && type != "normal" && success) {
// If we don't know what type this is, look up volume data
yield check_for_volume_info(gfile);
}
// Ensure directory exists
try {
gfile.make_directory_with_parents (null);
}
catch (IOError.EXISTS err2) {
// ignore
// Ensure directory exists
try {
gfile.make_directory_with_parents (null);
}
catch (IOError.EXISTS err2) {
// ignore
}
}
envp_ready(success, new List<string>());
......
......@@ -497,9 +497,9 @@ public class ConfigLocation : ConfigWidget
else if (index == index_u1)
settings.set_string(BACKEND_KEY, "u1");
else if (index == index_ssh)
set_remote_info("sftp");
yield set_remote_info("sftp");
else if (index == index_ftp)
set_remote_info("ftp");
yield set_remote_info("ftp");
else if (index == index_dav) {
// Support not overriding davs with dav by checking current value
var fsettings = DejaDup.get_settings(FILE_ROOT);
......@@ -507,14 +507,14 @@ public class ConfigLocation : ConfigWidget
ConfigURLPart.Part.SCHEME);
if (scheme != "dav" && scheme != "davs")
scheme = "dav"; // default to non-https, since we do default to encrypted backups
set_remote_info(scheme);
yield set_remote_info(scheme);
}
else if (index == index_smb)
set_remote_info("smb");
yield set_remote_info("smb");
else if (index == index_local)
set_remote_info("file");
yield set_remote_info("file");
else if (index == index_custom)
set_remote_info(null);
yield set_remote_info(null);
else if (uuid != null)
yield set_volume_info(iter);
else {
......@@ -549,7 +549,7 @@ public class ConfigLocation : ConfigWidget
yield BackendFile.set_volume_info(vol);
}
void set_remote_info(string? scheme)
async void set_remote_info(string? scheme)
{
var fsettings = DejaDup.get_settings(FILE_ROOT);
fsettings.delay();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment