mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-24 18:22:07 +03:00
files: show a warning when the working directory is gone (when used)
Instead of silently opening an empty buffer when the user tries to open a file in the current but disappeared directory, give a clear warning about the absence of this directory. This improves the fix for https://savannah.gnu.org/bugs/?62244.
This commit is contained in:
parent
fdd946c02c
commit
940b5eaad1
@ -351,6 +351,14 @@ bool has_valid_path(const char *filename)
|
|||||||
struct stat parentinfo;
|
struct stat parentinfo;
|
||||||
bool validity = FALSE;
|
bool validity = FALSE;
|
||||||
|
|
||||||
|
if (strcmp(parentdir, ".") == 0) {
|
||||||
|
char *currentdir = realpath(".", NULL);
|
||||||
|
|
||||||
|
if (currentdir == NULL)
|
||||||
|
statusline(ALERT, _("The working directory has disappeared"));
|
||||||
|
|
||||||
|
free(currentdir);
|
||||||
|
} else
|
||||||
if (stat(parentdir, &parentinfo) == -1) {
|
if (stat(parentdir, &parentinfo) == -1) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
/* TRANSLATORS: Keep the next ten messages at most 76 characters. */
|
/* TRANSLATORS: Keep the next ten messages at most 76 characters. */
|
||||||
|
Loading…
Reference in New Issue
Block a user