diff --git a/src/ht-builtin-init.c b/src/ht-builtin-init.c index 6c22f4df..4dc2d7f0 100644 --- a/src/ht-builtin-init.c +++ b/src/ht-builtin-init.c @@ -52,7 +52,7 @@ hacktree_builtin_init (int argc, char **argv, const char *prefix, GError **error repo_path = "."; htdir_path = g_build_filename (repo_path, HACKTREE_REPO_DIR, NULL); - htdir = g_file_new_for_path (htdir_path); + htdir = ht_util_new_file_for_path (htdir_path); if (!g_file_make_directory (htdir, NULL, error)) goto out; diff --git a/src/libhacktree/hacktree-repo.c b/src/libhacktree/hacktree-repo.c index 6781d25d..90b34ad7 100644 --- a/src/libhacktree/hacktree-repo.c +++ b/src/libhacktree/hacktree-repo.c @@ -132,7 +132,7 @@ hacktree_repo_constructor (GType gtype, g_assert (priv->path != NULL); - priv->repo_file = g_file_new_for_path (priv->path); + priv->repo_file = ht_util_new_file_for_path (priv->path); priv->head_ref_path = g_build_filename (priv->path, HACKTREE_REPO_DIR, "HEAD", NULL); priv->objects_path = g_build_filename (priv->path, HACKTREE_REPO_DIR, "objects", NULL); @@ -1534,7 +1534,7 @@ hacktree_repo_iter_objects (HacktreeRepo *self, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (priv->inited, FALSE); - objectdir = g_file_new_for_path (priv->objects_path); + objectdir = ht_util_new_file_for_path (priv->objects_path); enumerator = g_file_enumerate_children (objectdir, "standard::name,standard::type,unix::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, diff --git a/src/libhtutil/ht-gio-utils.c b/src/libhtutil/ht-gio-utils.c index 615699a4..c49b8832 100644 --- a/src/libhtutil/ht-gio-utils.c +++ b/src/libhtutil/ht-gio-utils.c @@ -105,3 +105,10 @@ ht_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **erro g_free (path); return ret; } + +/* Like g_file_new_for_path, but only do local stuff, not GVFS */ +GFile * +ht_util_new_file_for_path (const char *path) +{ + return g_vfs_get_file_for_path (g_vfs_get_local (), path); +} diff --git a/src/libhtutil/ht-gio-utils.h b/src/libhtutil/ht-gio-utils.h index 388a6544..c7342c4e 100644 --- a/src/libhtutil/ht-gio-utils.h +++ b/src/libhtutil/ht-gio-utils.h @@ -26,6 +26,8 @@ G_BEGIN_DECLS +GFile *ht_util_new_file_for_path (const char *path); + gboolean ht_util_ensure_directory (const char *path, gboolean with_parents, GError **error); char * ht_util_get_file_contents_utf8 (const char *path, GError **error);