diff options
author | Jens Finke <jens@triq.net> | 2002-10-14 19:03:37 +0000 |
---|---|---|
committer | Jens Finke <jens@src.gnome.org> | 2002-10-14 19:03:37 +0000 |
commit | 1195f480a653bfd7aafabf56fc950cc94417a3ac (patch) | |
tree | 10a8f0e52c0b6a7af06dda159a83019a00c477ee /shell | |
parent | 2d5a55007b9a0160ed06daa089cc1d651669efbe (diff) | |
download | eog-1195f480a653bfd7aafabf56fc950cc94417a3ac.tar.gz |
Reworked function, calls now gnome_vfs_unescape_string.
2002-10-14 Jens Finke <jens@triq.net>
* shell/main.c (make_canonical_uri): Reworked function, calls now
gnome_vfs_unescape_string.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/main.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/shell/main.c b/shell/main.c index 47407908..f95d2e12 100644 --- a/shell/main.c +++ b/shell/main.c @@ -55,41 +55,36 @@ create_app_list (gpointer data) static GnomeVFSURI* make_canonical_uri (const char *path) { - GnomeVFSURI *uri; - char *escaped; + GnomeVFSURI *uri = NULL; + char *plain; char *current_dir; char *canonical; char *concat_path; g_return_val_if_fail (path != NULL, NULL); - uri = NULL; + plain = gnome_vfs_unescape_string (path, "/"); - escaped = gnome_vfs_escape_path_string (path); - - if (strchr (escaped, ':') != NULL) { - uri = gnome_vfs_uri_new (escaped); - goto out; + if (strchr (plain, ':') != NULL) { + uri = gnome_vfs_uri_new (plain); } - - if (escaped[0] == '/') { - uri = gnome_vfs_uri_new (escaped); - goto out; + else if (plain[0] == '/') { + uri = gnome_vfs_uri_new (plain); } - - current_dir = g_get_current_dir (); - /* g_get_current_dir returns w/o trailing / */ - concat_path = g_strconcat (current_dir, "/", escaped, NULL); - canonical = gnome_vfs_make_path_name_canonical (concat_path); + else { + current_dir = g_get_current_dir (); + /* g_get_current_dir returns w/o trailing / */ + concat_path = g_build_filename (current_dir, plain, NULL); + canonical = gnome_vfs_make_path_name_canonical (concat_path); - uri = gnome_vfs_uri_new (canonical); + uri = gnome_vfs_uri_new (canonical); - g_free (current_dir); - g_free (canonical); - g_free (concat_path); + g_free (current_dir); + g_free (canonical); + g_free (concat_path); + } - out: - g_free (escaped); + g_free (plain); return uri; } |