Commit 7853a005 authored by Michael Terry's avatar Michael Terry

BackendFile: Switch a sync call to an async call

This avoids blocking when mounting a GFile location.
parent a9a33b12
......@@ -127,6 +127,19 @@ public abstract class BackendFile : Backend
this.unref();
}
async bool query_exists_async(File file)
{
try {
yield file.query_info_async(FileAttribute.STANDARD_TYPE,
FileQueryInfoFlags.NONE,
Priority.DEFAULT, null);
return true;
}
catch (Error e) {
return false;
}
}
async void do_mount() throws Error
{
yield mount();
......@@ -138,7 +151,7 @@ public abstract class BackendFile : Backend
// as they allow multiple files with the same name. Querying it
// anchors the path to the backend object and we don't create a second
// copy this way.
if (gfile != null && !gfile.query_exists()) {
if (gfile != null && !(yield query_exists_async(gfile))) {
try {
gfile.make_directory_with_parents (null);
}
......
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