fix possible crashes when going to parent directory, also fix case where attempting to go to parent directory from root would throw an error dialog

SVN revision: 74961
This commit is contained in:
Mike Blumenkrantz 2012-08-07 06:59:37 +00:00
parent c2b7cdb16c
commit 6790e78bb7
1 changed files with 5 additions and 6 deletions

View File

@ -1337,6 +1337,8 @@ e_fm2_has_parent_get(Evas_Object *obj)
{
EFM_SMART_CHECK(0);
if (!sd->path) return 0;
if (strcmp(sd->path, "/")) return 1;
if (!sd->realpath) return 0;
if ((sd->realpath[0] == 0) || (!strcmp(sd->realpath, "/"))) return 0;
return 1;
}
@ -1355,17 +1357,14 @@ e_fm2_parent_go(Evas_Object *obj)
EFM_SMART_CHECK();
if (!sd->path) return;
path = strdupa(sd->path);
if (!path) return;
if ((p = strrchr(path, '/'))) *p = 0;
if (*path)
e_fm2_path_set(obj, sd->dev, path);
else
else if (sd->realpath)
{
path = strdupa(sd->realpath);
p = strrchr(path, '/');
if (!p) return;
*p = 0;
path = ecore_file_dir_get(sd->realpath);
e_fm2_path_set(obj, "/", path);
free(path);
}
}