diff options
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/callproc.c b/src/callproc.c index b296bdb088b..dbbf15c792a 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -108,11 +108,8 @@ static Lisp_Object call_process (ptrdiff_t, Lisp_Object *, int, ptrdiff_t); | |||
| 108 | Lisp_Object | 108 | Lisp_Object |
| 109 | encode_current_directory (void) | 109 | encode_current_directory (void) |
| 110 | { | 110 | { |
| 111 | Lisp_Object dir; | 111 | Lisp_Object curdir = BVAR (current_buffer, directory); |
| 112 | 112 | Lisp_Object dir = Funhandled_file_name_directory (curdir); | |
| 113 | dir = BVAR (current_buffer, directory); | ||
| 114 | |||
| 115 | dir = Funhandled_file_name_directory (dir); | ||
| 116 | 113 | ||
| 117 | /* If the file name handler says that dir is unreachable, use | 114 | /* If the file name handler says that dir is unreachable, use |
| 118 | a sensible default. */ | 115 | a sensible default. */ |
| @@ -120,17 +117,10 @@ encode_current_directory (void) | |||
| 120 | dir = build_string ("~"); | 117 | dir = build_string ("~"); |
| 121 | 118 | ||
| 122 | dir = expand_and_dir_to_file (dir); | 119 | dir = expand_and_dir_to_file (dir); |
| 123 | |||
| 124 | if (NILP (Ffile_accessible_directory_p (dir))) | ||
| 125 | report_file_error ("Setting current directory", | ||
| 126 | BVAR (current_buffer, directory)); | ||
| 127 | |||
| 128 | /* Remove "/:" from DIR and encode it. */ | ||
| 129 | dir = ENCODE_FILE (remove_slash_colon (dir)); | 120 | dir = ENCODE_FILE (remove_slash_colon (dir)); |
| 130 | 121 | ||
| 131 | if (! file_accessible_directory_p (dir)) | 122 | if (! file_accessible_directory_p (dir)) |
| 132 | report_file_error ("Setting current directory", | 123 | report_file_error ("Setting current directory", curdir); |
| 133 | BVAR (current_buffer, directory)); | ||
| 134 | 124 | ||
| 135 | return dir; | 125 | return dir; |
| 136 | } | 126 | } |
| @@ -1570,20 +1560,19 @@ init_callproc (void) | |||
| 1570 | source directory. */ | 1560 | source directory. */ |
| 1571 | if (data_dir == 0) | 1561 | if (data_dir == 0) |
| 1572 | { | 1562 | { |
| 1573 | Lisp_Object tem, tem1, srcdir; | 1563 | Lisp_Object tem, srcdir; |
| 1574 | Lisp_Object lispdir = Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)); | 1564 | Lisp_Object lispdir = Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)); |
| 1575 | 1565 | ||
| 1576 | srcdir = Fexpand_file_name (build_string ("../src/"), lispdir); | 1566 | srcdir = Fexpand_file_name (build_string ("../src/"), lispdir); |
| 1577 | 1567 | ||
| 1578 | tem = Fexpand_file_name (build_string ("NEWS"), Vdata_directory); | 1568 | tem = Fexpand_file_name (build_string ("NEWS"), Vdata_directory); |
| 1579 | tem1 = Ffile_exists_p (tem); | 1569 | if (!NILP (Fequal (srcdir, Vinvocation_directory)) |
| 1580 | if (!NILP (Fequal (srcdir, Vinvocation_directory)) || NILP (tem1)) | 1570 | || !file_access_p (SSDATA (tem), F_OK)) |
| 1581 | { | 1571 | { |
| 1582 | Lisp_Object newdir; | 1572 | Lisp_Object newdir; |
| 1583 | newdir = Fexpand_file_name (build_string ("../etc/"), lispdir); | 1573 | newdir = Fexpand_file_name (build_string ("../etc/"), lispdir); |
| 1584 | tem = Fexpand_file_name (build_string ("NEWS"), newdir); | 1574 | tem = Fexpand_file_name (build_string ("NEWS"), newdir); |
| 1585 | tem1 = Ffile_exists_p (tem); | 1575 | if (file_access_p (SSDATA (tem), F_OK)) |
| 1586 | if (!NILP (tem1)) | ||
| 1587 | Vdata_directory = newdir; | 1576 | Vdata_directory = newdir; |
| 1588 | } | 1577 | } |
| 1589 | } | 1578 | } |
| @@ -1605,9 +1594,22 @@ init_callproc (void) | |||
| 1605 | Lisp_Object gamedir = Qnil; | 1594 | Lisp_Object gamedir = Qnil; |
| 1606 | if (PATH_GAME) | 1595 | if (PATH_GAME) |
| 1607 | { | 1596 | { |
| 1608 | Lisp_Object path_game = build_unibyte_string (PATH_GAME); | 1597 | const char *cpath_game = PATH_GAME; |
| 1598 | #ifdef WINDOWSNT | ||
| 1599 | /* On MS-Windows, PATH_GAME normally starts with a literal | ||
| 1600 | "%emacs_dir%", so it will never work without some tweaking. */ | ||
| 1601 | cpath_game = w32_relocate (cpath_game); | ||
| 1602 | #endif | ||
| 1603 | Lisp_Object path_game = build_unibyte_string (cpath_game); | ||
| 1609 | if (file_accessible_directory_p (path_game)) | 1604 | if (file_accessible_directory_p (path_game)) |
| 1610 | gamedir = path_game; | 1605 | gamedir = path_game; |
| 1606 | else if (errno != ENOENT && errno != ENOTDIR | ||
| 1607 | #ifdef DOS_NT | ||
| 1608 | /* DOS/Windows sometimes return EACCES for bad file names */ | ||
| 1609 | && errno != EACCES | ||
| 1610 | #endif | ||
| 1611 | ) | ||
| 1612 | dir_warning ("game dir", path_game); | ||
| 1611 | } | 1613 | } |
| 1612 | Vshared_game_score_directory = gamedir; | 1614 | Vshared_game_score_directory = gamedir; |
| 1613 | } | 1615 | } |