diff options
author | Po Lu <luangruo@yahoo.com> | 2023-01-21 20:03:37 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2023-01-21 20:03:37 +0800 |
commit | aaacf24ca25fc284038ec9f17be358067309a8cf (patch) | |
tree | 1918e52c6560b56465b9b3ca1508a7c6fb6881f9 /src/dired.c | |
parent | a03eeb0109334942a8fdee777697a25c2db82ab1 (diff) |
Update Android port
* doc/emacs/android.texi (Android File System): Document that
ls-lisp is now used by default.
* java/org/gnu/emacs/EmacsThread.java (EmacsThread): Name the
thread something meaningful.
* lisp/loadup.el (featurep): Load ls-lisp on Android.
* lisp/ls-lisp.el (ls-lisp-use-insert-directory-program):
Default to off on Android.
* src/android.c (android_is_directory): New fucntion.
(android_fstatat): Handle directories created by
`android_opendir'.
(android_open): Return meaningful file mode.
(struct android_dir): New fields `next', `asset_file' and `fd'.
(android_opendir): Populate those fields.
(android_dirfd): New function.
(android_closedir): Close file descriptor if set.
(android_lookup_asset_directory_fd): New function.
* src/android.h: Update prototypes.
* src/androidfont.c (androidfont_check_init): New function.
(androidfont_list, androidfont_match, androidfont_draw)
(androidfont_open_font, androidfont_close_font)
(androidfont_has_char, androidfont_encode_char)
(androidfont_text_extents, androidfont_list_family): Initialize
font driver if necessary.
(init_androidfont): Don't initialize Java font if necessary.
* src/dired.c (open_directory): Return android_dirfd if
appropriate.
(directory_files_internal, file_name_completion_dirp): Implement
correctly for Android.
* src/fileio.c (check_mutable_filename): New function.
(Fcopy_file, Fdelete_directory_internal, Fdelete_file)
(Frename_file, Fadd_name_to_file, Fmake_symbolic_link)
(Fset_file_modes, Fset_file_times, Ffile_newer_than_file_p)
(Fverify_visited_file_modtime, Fset_visited_file_modtime): Check
that files being written to do not lie in /assets.
* src/sfntfont-android.c (GET_SCANLINE_BUFFER)
(sfntfont_android_u255to256, sfntfont_android_over_8888_1)
(sfntfont_android_over_8888, sfntfont_android_composite_bitmap):
Optimize on 64-bit ARM devices.
(sfntfont_android_put_glyphs): Optimize away memset if
background need not be filled.
Diffstat (limited to 'src/dired.c')
-rw-r--r-- | src/dired.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/dired.c b/src/dired.c index 57d79b84463..ced08a35643 100644 --- a/src/dired.c +++ b/src/dired.c @@ -116,6 +116,9 @@ open_directory (Lisp_Object dirname, Lisp_Object encoded_dirname, int *fdp) d = opendir (name); #else d = android_opendir (name); + + if (d) + fd = android_dirfd (d); #endif opendir_errno = errno; #else @@ -216,6 +219,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object encoded_dirfilename = ENCODE_FILE (dirfilename); int fd; + + /* Keep in mind that FD is not always a real file descriptor on + Android. */ emacs_dir *d = open_directory (dirfilename, encoded_dirfilename, &fd); /* Unfortunately, we can now invoke expand-file-name and @@ -881,6 +887,13 @@ file_name_completion_dirp (int fd, struct dirent *dp, ptrdiff_t len) char *subdir_name = SAFE_ALLOCA (len + 2); memcpy (subdir_name, dp->d_name, len); strcpy (subdir_name + len, "/"); + +#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY + /* Check if subdir_name lies in the assets directory. */ + if (android_file_access_p (subdir_name, F_OK)) + return true; +#endif + bool dirp = faccessat (fd, subdir_name, F_OK, AT_EACCESS) == 0; SAFE_FREE (); return dirp; |