diff options
author | Jeff Garrett <jeff@jgarrett.org> | 2007-10-30 00:25:10 +0000 |
---|---|---|
committer | Jeff Garrett <jeff@jgarrett.org> | 2007-10-30 00:25:10 +0000 |
commit | 0b4f5408c5106c8df0403068d1399ae3d3064114 (patch) | |
tree | 31e22eede65469935958855fe2a592169b4911b3 | |
parent | c15271d9cabdc0fc2aee68dccc5c6c0e38abf87f (diff) |
Allow remote URIs in import_tiger_from_uri
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/import_tiger.c | 17 |
2 files changed, 15 insertions, 6 deletions
@@ -1,3 +1,7 @@ +2007-10-30 Jeff Garrett <jeff@jgarrett.org> + + * src/import_tiger.c: Allow remote URIs in import_tiger_from_uri + 2007-09-09 Jeff Garrett <jeff@jgarrett.org> * src/main.c: Fix typo in database configuration file parse diff --git a/src/import_tiger.c b/src/import_tiger.c index 77ef94e..fe9dc79 100644 --- a/src/import_tiger.c +++ b/src/import_tiger.c @@ -1193,18 +1193,23 @@ gboolean import_tiger_from_uri(const gchar* pszURI, gint nTigerSetNumber) importwindow_progress_pulse(); + // + // Make a temporary directory + // + gchar* pszTempDir = g_strdup_printf("%s/roadster", g_get_tmp_dir()); + gnome_vfs_make_directory(pszTempDir, 0700); + gchar* pszLocalFileUri = g_strdup_printf("file:///%s/tiger.zip", pszTempDir); + // convert from "file:///path/to/file" to "/path/to/file" (only works on local files) - gchar* pszLocalFilePath = gnome_vfs_get_local_path_from_uri(pszURI); + gchar* pszLocalFilePath = gnome_vfs_get_local_path_from_uri(pszLocalFileUri); if(pszLocalFilePath == NULL) { g_warning("import_tiger_from_uri: gnome_vfs_get_local_path_from_uri failed (not local?)\n"); return FALSE; } - // - // Make a temporary directory for ZIP file contents - // - gchar* pszTempDir = g_strdup_printf("%s/roadster", g_get_tmp_dir()); - gnome_vfs_make_directory(pszTempDir, 0700); + GnomeVFSURI *src = gnome_vfs_uri_new(pszURI); + GnomeVFSURI *dst = gnome_vfs_uri_new(pszLocalFileUri); + gnome_vfs_xfer_uri(src, dst, GNOME_VFS_XFER_DEFAULT, GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, NULL, NULL); // // Create unzip command line |