startup: show an error message when argument of --operatingdir is invalid
Move the initialization of the operating directory to after the initialization of the screen, so that the above error can be shown. This fixes the first part of https://savannah.gnu.org/bugs/?47798.master
parent
60da39cdf7
commit
c0285682e4
|
@ -1591,6 +1591,7 @@ void init_operating_dir(void)
|
||||||
/* If get_full_path() failed or the operating directory is
|
/* If get_full_path() failed or the operating directory is
|
||||||
* inaccessible, unset operating_dir. */
|
* inaccessible, unset operating_dir. */
|
||||||
if (full_operating_dir == NULL || chdir(full_operating_dir) == -1) {
|
if (full_operating_dir == NULL || chdir(full_operating_dir) == -1) {
|
||||||
|
statusline(ALERT, _("Not a valid directory: %s"), operating_dir);
|
||||||
free(full_operating_dir);
|
free(full_operating_dir);
|
||||||
full_operating_dir = NULL;
|
full_operating_dir = NULL;
|
||||||
free(operating_dir);
|
free(operating_dir);
|
||||||
|
|
12
src/nano.c
12
src/nano.c
|
@ -2422,12 +2422,6 @@ int main(int argc, char **argv)
|
||||||
init_backup_dir();
|
init_backup_dir();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_OPERATINGDIR
|
|
||||||
/* Set up the operating directory. This entails chdir()ing there,
|
|
||||||
* so that file reads and writes will be based there. */
|
|
||||||
init_operating_dir();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
/* If punct wasn't specified, set its default value. */
|
/* If punct wasn't specified, set its default value. */
|
||||||
if (punct == NULL)
|
if (punct == NULL)
|
||||||
|
@ -2559,6 +2553,12 @@ int main(int argc, char **argv)
|
||||||
controlright = key_defined(keyvalue);
|
controlright = key_defined(keyvalue);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DISABLE_OPERATINGDIR
|
||||||
|
/* Set up the operating directory. This entails chdir()ing there,
|
||||||
|
* so that file reads and writes will be based there. */
|
||||||
|
init_operating_dir();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Main: open file\n");
|
fprintf(stderr, "Main: open file\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue