<p>In <a href="https://github.com/geany/geany/pull/963#discussion_r56771097">src/utils.c</a>:</p>
<pre style='color:#555'>> @@ -2188,3 +2188,91 @@ void utils_start_new_geany_instance(const gchar *doc_path)
>    else
>            g_printerr("Unable to find 'geany'");
>  }
> +
> +
> +static GFile *utils_gfile_create(const gchar *fname)
> +{
> +  if (utils_is_uri(fname))
> +          return g_file_new_for_uri(fname);
> +  return g_file_new_for_path(fname);
> +}
> +
> +
> +/**
> + *  Tests file existence using the configured IO method in Geany.
> + *
> + *  @param fname File name.
</pre>
<p>When you have a look at the plugins the patch affects, they do (maybe not all the g_file_test()s deal with possibly remote files but some definitely do).</p>

<p>But the question is good - we probably shouldn't make an utility function for every single IO function - instead there should be something like </p>

<p>utils_use_gio()</p>

<p>and plugins should use it as needed (we'll already need this for the saveaction plugin which needs to be updated to make a backup copy of a possibly remote file). This will lead to a minor code duplication in the plugins but I think from the API perspective this is the right way. What do you think?</p>

<p>The other question is whether to make such a function inside utils or somewhere else (prefs?) or whether to make it e.g. a variable in some config struct. Ideas?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/geany/geany/pull/963/files/4d2f2045b35231c944904edd5540bf6beff7a003#r56771097">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ9fK07e2KJCddy18gamaGvkBjP1Vks5pvasWgaJpZM4HvqFb.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/963/files/4d2f2045b35231c944904edd5540bf6beff7a003#r56771097"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>