Commit 732cf390 authored by Christian Hergert's avatar Christian Hergert
Browse files

rust-analyzer: handle reaching / gracefully

parent 73f0844c
Pipeline #262663 canceled with stages
in 12 minutes and 30 seconds
......@@ -73,17 +73,20 @@ find_cargo_toml_from_file (GFile *file)
if (file != NULL)
{
g_autoptr(GFile) parent = g_file_get_parent (file);
g_autoptr(GFile) cargo_toml = g_file_get_child (parent, "Cargo.toml");
g_autofree gchar *name = g_file_get_basename (file);
if (g_strcmp0 (name, "Cargo.toml") == 0)
return g_steal_pointer (&parent);
if (parent != NULL)
{
g_autoptr(GFile) cargo_toml = g_file_get_child (parent, "Cargo.toml");
if (g_file_query_exists (cargo_toml, NULL))
return g_steal_pointer (&cargo_toml);
if (g_strcmp0 (name, "Cargo.toml") == 0)
return g_steal_pointer (&parent);
if (parent != NULL)
return find_cargo_toml_from_file (parent);
if (g_file_query_exists (cargo_toml, NULL))
return g_steal_pointer (&cargo_toml);
return find_cargo_toml_from_file (parent);
}
}
return 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