tweaks: simplify a fragment of code, and fold two lines together
This commit is contained in:
parent
940b5eaad1
commit
603ce231d0
@ -709,14 +709,10 @@ char *browse_in(const char *inpath)
|
||||
path = free_and_assign(path, strip_last_component(path));
|
||||
|
||||
if (stat(path, &fileinfo) == -1 || !S_ISDIR(fileinfo.st_mode)) {
|
||||
char *currentdir = nmalloc(PATH_MAX + 1);
|
||||
|
||||
path = free_and_assign(path, getcwd(currentdir, PATH_MAX + 1));
|
||||
path = free_and_assign(path, realpath(".", NULL));
|
||||
|
||||
if (path == NULL) {
|
||||
statusline(MILD, _("The working directory has disappeared"));
|
||||
free(currentdir);
|
||||
beep();
|
||||
statusline(ALERT, _("The working directory has disappeared"));
|
||||
napms(1200);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -358,8 +358,7 @@ bool has_valid_path(const char *filename)
|
||||
statusline(ALERT, _("The working directory has disappeared"));
|
||||
|
||||
free(currentdir);
|
||||
} else
|
||||
if (stat(parentdir, &parentinfo) == -1) {
|
||||
} else if (stat(parentdir, &parentinfo) == -1) {
|
||||
if (errno == ENOENT)
|
||||
/* TRANSLATORS: Keep the next ten messages at most 76 characters. */
|
||||
statusline(ALERT, _("Directory '%s' does not exist"), parentdir);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user