diff options
author | John Sullivan <sullivan@src.gnome.org> | 2001-01-18 19:18:52 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2001-01-18 19:18:52 +0000 |
commit | aee3945efe11c38873effaa5aff0121163cd030e (patch) | |
tree | 6e07d5b71a5973a7ad32d745d88cc7bc416f605a /libnautilus-private/nautilus-file-utilities.c | |
parent | a3d891380b2544cb99f763e3944bb98b6a52a91e (diff) | |
download | nautilus-aee3945efe11c38873effaa5aff0121163cd030e.tar.gz |
reviewed by: Darin Adler <darin@eazel.com>
* libnautilus-extensions/nautilus-file-utilities.c:
(nautilus_make_uri_from_input):
* libnautilus-extensions/nautilus-link-set.c:
(nautilus_link_set_install):
Used new gnome_vfs_expand_initial_tilde in two places
that were doing this independently (one of which is
where the code for the gnome-vfs routine came from).
Diffstat (limited to 'libnautilus-private/nautilus-file-utilities.c')
-rw-r--r-- | libnautilus-private/nautilus-file-utilities.c | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c index 2eb762eed..046d652f5 100644 --- a/libnautilus-private/nautilus-file-utilities.c +++ b/libnautilus-private/nautilus-file-utilities.c @@ -121,38 +121,6 @@ has_valid_scheme (const char *uri) return *p == ':'; } -static char * -expand_tilde (const char *path) -{ - char *slash_after_user_name, *user_name; - struct passwd *passwd_file_entry; - - g_assert (path != NULL); - g_assert (path[0] == '~'); - - if (path[1] == '/' || path[1] == '\0') { - return g_strconcat (g_get_home_dir (), &path[1], NULL); - } - - slash_after_user_name = strchr (&path[1], '/'); - if (slash_after_user_name == NULL) { - user_name = g_strdup (&path[1]); - } else { - user_name = g_strndup (&path[1], - slash_after_user_name - &path[1]); - } - passwd_file_entry = getpwnam (user_name); - g_free (user_name); - - if (passwd_file_entry == NULL || passwd_file_entry->pw_dir == NULL) { - return NULL; - } - - return g_strconcat (passwd_file_entry->pw_dir, - slash_after_user_name, - NULL); -} - /** * nautilus_make_uri_from_input: * @@ -184,12 +152,8 @@ nautilus_make_uri_from_input (const char *location) uri = gnome_vfs_get_uri_from_local_path (stripped); break; case '~': - path = expand_tilde (stripped); - if (path == NULL) { - uri = g_strdup (stripped); - } else { - uri = gnome_vfs_get_uri_from_local_path (path); - } + path = gnome_vfs_expand_initial_tilde (stripped); + uri = gnome_vfs_get_uri_from_local_path (path); g_free (path); break; default: |