summaryrefslogtreecommitdiff
path: root/src/callproc.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-03-01 15:49:02 +0800
committerPo Lu <luangruo@yahoo.com>2023-03-01 15:49:02 +0800
commitad8e12b9f9937f999a277e2608a1098a1c494532 (patch)
treebfa7e4f1339475eb4d8ecaae77852d3f3dc258fb /src/callproc.c
parent194b3f948cba9f6da0e5d3b36ada8ab9ca74d482 (diff)
downloademacs-ad8e12b9f9937f999a277e2608a1098a1c494532.tar.gz
Update Android port
* doc/emacs/android.texi (Android File System): Document new behavior of starting a subprocess from /assets. * java/org/gnu/emacs/EmacsWindow.java (onSomeKindOfMotionEvent): Don't use isFromSource where not present. * src/androidterm.c (android_scroll_run): Avoid undefined behavior writing to bitfields. * src/callproc.c (get_current_directory): When trying to run a subprocess inside /assets, run it from the home directory instead.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/callproc.c b/src/callproc.c
index e15eebe23dd..ea9c946f158 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -144,7 +144,11 @@ static CHILD_SETUP_TYPE child_setup (int, int, int, char **, char **,
directory if it's unreachable. If ENCODE is true, return as a string
suitable for a system call; otherwise, return a string in its
internal representation. Signal an error if the result would not be
- an accessible directory. */
+ an accessible directory.
+
+ If the default directory lies inside a special directory which
+ cannot be made the current working directory, and ENCODE is also
+ set, simply return the home directory. */
Lisp_Object
get_current_directory (bool encode)
@@ -157,6 +161,19 @@ get_current_directory (bool encode)
if (NILP (dir))
dir = build_string ("~");
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
+
+ /* If DIR is an asset directory or a content directory, return
+ the home directory instead. */
+
+ if (encode && (!strcmp (SSDATA (dir), "/assets")
+ || !strncmp (SSDATA (dir), "/assets/", 8)
+ || !strcmp (SSDATA (dir), "/content")
+ || !strncmp (SSDATA (dir), "/content/", 9)))
+ dir = build_string ("~");
+
+#endif /* HAVE_ANDROID && ANDROID_STUBIFY */
+
dir = expand_and_dir_to_file (dir);
Lisp_Object encoded_dir = ENCODE_FILE (remove_slash_colon (dir));