diff --git a/packages/fresh-editor/build.sh b/packages/fresh-editor/build.sh index 486f871529..c661760f6f 100644 --- a/packages/fresh-editor/build.sh +++ b/packages/fresh-editor/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Text editor for your terminal: easy, powerful and fast" TERMUX_PKG_LICENSE="GPL-2.0-only" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="0.1.90" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL="https://github.com/sinelaw/fresh/releases/download/v$TERMUX_PKG_VERSION/fresh-editor-$TERMUX_PKG_VERSION-source.tar.gz" TERMUX_PKG_SHA256=c55087ac14256965aa41dbfff1f4df2632d10dd6a12f0f7a5bfa1a3870e71375 TERMUX_PKG_AUTO_UPDATE=true @@ -30,6 +31,11 @@ termux_step_pre_configure() { echo "Applying patch: $patch" patch -p1 -d "$dir" < "$patch" + patch="$TERMUX_PKG_BUILDER_DIR/trash-rs-implement-get_mount_points-android.diff" + dir="vendor/trash" + echo "Applying patch: $patch" + patch -p1 -d "$dir" < "$patch" + echo "" >> Cargo.toml echo '[patch.crates-io]' >> Cargo.toml echo 'trash = { path = "./vendor/trash" }' >> Cargo.toml diff --git a/packages/fresh-editor/trash-rs-implement-get_mount_points-android.diff b/packages/fresh-editor/trash-rs-implement-get_mount_points-android.diff new file mode 100644 index 0000000000..7f18c272b1 --- /dev/null +++ b/packages/fresh-editor/trash-rs-implement-get_mount_points-android.diff @@ -0,0 +1,45 @@ +This dirty implementation of get_mount_points() for trash-rs for Android +has been tested and confirmed to work good enough to suceessfully move files to trash +in reverse dependency Yazi on Samsung Galaxy A70 SM-A705FN with LineageOS 20 Android 13 SELinux Enabled + +--- a/src/freedesktop.rs ++++ b/src/freedesktop.rs +@@ -784,6 +784,28 @@ fn get_mount_points() -> Result, Error> { + Ok(result) + } + ++#[cfg(target_os = "android")] ++fn get_mount_points() -> Result, Error> { ++ // assume '/data' and '/strorage/emulated/0' are mounted ++ // for some reason, 'getmntent()' is not available in Rust on Android, ++ // despite being available in C on Android. ++ // https://github.com/rust-lang/libc/blob/0403150379d66216e90a0f8a804ae1ca33691067/src/unix/linux_like/android/mod.rs ++ let mut result = Vec::new(); ++ let mount_point = MountPoint { ++ mnt_dir: "/data".into(), ++ _mnt_fsname: "/this/should/not/matter".to_string(), ++ _mnt_type: "ext4".to_string() ++ }; ++ result.push(mount_point); ++ let mount_point = MountPoint { ++ mnt_dir: "/storage/emulated/0".into(), ++ _mnt_fsname: "/this/should/not/matter".to_string(), ++ _mnt_type: "fuse".to_string() ++ }; ++ result.push(mount_point); ++ Ok(result) ++} ++ + #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))] + fn get_mount_points() -> Result, Error> { + use once_cell::sync::Lazy; +@@ -898,7 +914,8 @@ fn get_mount_points() -> Result, Error> { + target_os = "dragonfly", + target_os = "freebsd", + target_os = "openbsd", +- target_os = "netbsd" ++ target_os = "netbsd", ++ target_os = "android" + )))] + fn get_mount_points() -> Result, Error> { + // On platforms that don't have support yet, return an error