Exemplo n.º 1
0
void
g_mount_spec_set_mount_prefix  (GMountSpec      *spec,
				const char      *mount_prefix)
{
  g_free (spec->mount_prefix);
  spec->mount_prefix = g_mount_spec_canonicalize_path (mount_prefix);
}
Exemplo n.º 2
0
static gboolean
try_mount (GVfsBackend  *backend,
           GVfsJobMount *job,
           GMountSpec   *mount_spec,
           GMountSource *mount_source,
           gboolean      is_automount)
{
  GVfsBackendHttp *op_backend;
  const char      *uri_str;
  char            *path;
  SoupURI         *uri;
  GMountSpec      *real_mount_spec;

  op_backend = G_VFS_BACKEND_HTTP (backend);

  uri = NULL;
  uri_str = g_mount_spec_get (mount_spec, "uri");

  if (uri_str)
    uri = soup_uri_new (uri_str);

  g_debug ("+ try_mount: %s\n", uri_str ? uri_str : "(null)");

  if (uri == NULL)
    {
      g_vfs_job_failed (G_VFS_JOB (job),
                        G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
                        _("Invalid mount spec"));
      return TRUE;
    }

  real_mount_spec = g_mount_spec_new ("http");
  g_mount_spec_set (real_mount_spec, "uri", uri_str);

  if (uri->path != NULL)
    {
      path = g_uri_unescape_string (uri->path, "/");
      g_free (real_mount_spec->mount_prefix);
      real_mount_spec->mount_prefix = g_mount_spec_canonicalize_path (path);
      g_free (path);
    }

  g_vfs_backend_set_mount_spec (backend, real_mount_spec);

  op_backend->mount_base = uri;

  g_vfs_job_succeeded (G_VFS_JOB (job));
  return TRUE;
}
Exemplo n.º 3
0
/* Takes ownership of passed in data */
GMountSpec *
g_mount_spec_new_from_data (GArray *items,
			    char *mount_prefix)
{
  GMountSpec *spec;

  spec = g_new0 (GMountSpec, 1);
  spec->ref_count = 1;
  spec->items = items;
  if (mount_prefix == NULL)
    spec->mount_prefix = g_strdup ("/");
  else
    spec->mount_prefix = g_mount_spec_canonicalize_path (mount_prefix);

  g_array_sort (spec->items, item_compare);
  
  return spec;
}