mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: enable unwinding on Windows release builds (#2286)
This commit is contained in:
parent
7f1e9b83fd
commit
4e96341f51
9 changed files with 37 additions and 17 deletions
6
.github/workflows/draft.yml
vendored
6
.github/workflows/draft.yml
vendored
|
|
@ -96,15 +96,15 @@ jobs:
|
|||
uses: mozilla-actions/sccache-action@v0.0.6
|
||||
|
||||
- name: Build
|
||||
run: cargo build --release --locked --target ${{ matrix.target }}
|
||||
run: cargo build --profile release-windows --locked --target ${{ matrix.target }}
|
||||
|
||||
- name: Pack artifact
|
||||
env:
|
||||
TARGET_NAME: yazi-${{ matrix.target }}
|
||||
run: |
|
||||
New-Item -ItemType Directory -Path ${env:TARGET_NAME}
|
||||
Copy-Item -Path "target\${{ matrix.target }}\release\ya.exe" -Destination ${env:TARGET_NAME}
|
||||
Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:TARGET_NAME}
|
||||
Copy-Item -Path "target\${{ matrix.target }}\release-windows\ya.exe" -Destination ${env:TARGET_NAME}
|
||||
Copy-Item -Path "target\${{ matrix.target }}\release-windows\yazi.exe" -Destination ${env:TARGET_NAME}
|
||||
Copy-Item -Path "yazi-boot\completions" -Destination ${env:TARGET_NAME} -Recurse
|
||||
Copy-Item -Path "README.md", "LICENSE" -Destination ${env:TARGET_NAME}
|
||||
Compress-Archive -Path ${env:TARGET_NAME} -DestinationPath "${env:TARGET_NAME}.zip"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ lto = true
|
|||
panic = "abort"
|
||||
strip = true
|
||||
|
||||
[profile.release-windows]
|
||||
inherits = "release"
|
||||
panic = "unwind"
|
||||
|
||||
[workspace.dependencies]
|
||||
ansi-to-tui = "7.0.0"
|
||||
anyhow = "1.0.95"
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ use parking_lot::RwLock;
|
|||
use tokio::{fs, pin, sync::{mpsc::{self, UnboundedReceiver}, watch}};
|
||||
use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
||||
use tracing::error;
|
||||
use yazi_dds::Pubsub;
|
||||
use yazi_fs::{Cha, File, Files, FilesOp, mounts::PARTITIONS, realname_unchecked};
|
||||
use yazi_fs::{Cha, File, Files, FilesOp, realname_unchecked};
|
||||
use yazi_proxy::WATCHER;
|
||||
use yazi_shared::{RoCell, url::Url};
|
||||
|
||||
|
|
@ -44,7 +43,10 @@ impl Watcher {
|
|||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
yazi_fs::mounts::Partitions::monitor(PARTITIONS.clone(), Pubsub::pub_from_mount);
|
||||
yazi_fs::mounts::Partitions::monitor(
|
||||
yazi_fs::mounts::PARTITIONS.clone(),
|
||||
yazi_dds::Pubsub::pub_from_mount,
|
||||
);
|
||||
|
||||
tokio::spawn(Self::fan_out(out_rx));
|
||||
Self { in_tx, out_tx }
|
||||
|
|
|
|||
12
yazi-fm/build.rs
Normal file
12
yazi-fm/build.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use std::{env, error::Error};
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let dir = env::var("OUT_DIR").unwrap();
|
||||
if dir.contains("\\target\\release\\build\\yazi-fm-") {
|
||||
panic!(
|
||||
"Unwinding must be enabled for Windows. Please use `cargo build --profile release-windows --locked` instead to build Yazi."
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -152,11 +152,11 @@ impl Cha {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new_nofollow(path: &Path, meta: Metadata) -> Self {
|
||||
pub fn new_nofollow(_path: &Path, meta: Metadata) -> Self {
|
||||
let mut attached = ChaKind::empty();
|
||||
|
||||
#[cfg(unix)]
|
||||
if yazi_shared::url::Urn::new(path).is_hidden() {
|
||||
if yazi_shared::url::Urn::new(_path).is_hidden() {
|
||||
attached |= ChaKind::HIDDEN;
|
||||
}
|
||||
#[cfg(windows)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::{ffi::{OsStr, OsString}, path::PathBuf};
|
||||
use std::{ffi::OsString, path::PathBuf};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Partition {
|
||||
|
|
@ -19,14 +19,14 @@ impl Partition {
|
|||
|
||||
#[rustfmt::skip]
|
||||
pub fn systemic(&self) -> bool {
|
||||
let b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes());
|
||||
let _b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes());
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
matches!(b, b"autofs" | b"binfmt_misc" | b"bpf" | b"cgroup2" | b"configfs" | b"debugfs" | b"devpts" | b"devtmpfs" | b"fuse.gvfsd-fuse" | b"fusectl" | b"hugetlbfs" | b"mqueue" | b"proc" | b"pstore" | b"ramfs" | b"securityfs" | b"sysfs" | b"tmpfs" | b"tracefs")
|
||||
matches!(_b, b"autofs" | b"binfmt_misc" | b"bpf" | b"cgroup2" | b"configfs" | b"debugfs" | b"devpts" | b"devtmpfs" | b"fuse.gvfsd-fuse" | b"fusectl" | b"hugetlbfs" | b"mqueue" | b"proc" | b"pstore" | b"ramfs" | b"securityfs" | b"sysfs" | b"tmpfs" | b"tracefs")
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
b.is_empty()
|
||||
_b.is_empty()
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
{
|
||||
|
|
@ -38,13 +38,13 @@ impl Partition {
|
|||
impl Partition {
|
||||
#[inline]
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
pub(super) fn new(name: &OsStr) -> Self {
|
||||
pub(super) fn new(name: &std::ffi::OsStr) -> Self {
|
||||
Self { src: std::path::Path::new("/dev/").join(name).into(), ..Default::default() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(target_os = "linux")]
|
||||
pub(super) fn dev_name(&self) -> Option<&OsStr> {
|
||||
pub(super) fn dev_name(&self) -> Option<&std::ffi::OsStr> {
|
||||
std::path::Path::new(&self.src).strip_prefix("/dev/").ok().map(|p| p.as_os_str())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ impl Partitions {
|
|||
self.inner.iter().find(|p| p.rdev == Some(dev))
|
||||
}
|
||||
|
||||
pub fn heuristic(&self, cha: Cha) -> bool {
|
||||
pub fn heuristic(&self, _cha: Cha) -> bool {
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
{
|
||||
self.by_dev(cha.dev).is_none_or(|p| p.heuristic())
|
||||
self.by_dev(_cha.dev).is_none_or(|p| p.heuristic())
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::{ops::{Deref, Not}, time::{Duration, SystemTime, UNIX_EPOCH}};
|
||||
use std::{ops::Deref, time::{Duration, SystemTime, UNIX_EPOCH}};
|
||||
|
||||
use mlua::{ExternalError, FromLua, IntoLua, Lua, Table, UserData, UserDataFields, UserDataMethods};
|
||||
use yazi_fs::ChaKind;
|
||||
|
|
@ -74,6 +74,7 @@ impl UserData for Cha {
|
|||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::ops::Not;
|
||||
fields.add_field_method_get("dev", |_, me| Ok(me.is_dummy().not().then_some(me.dev)));
|
||||
fields.add_field_method_get("uid", |_, me| Ok(me.is_dummy().not().then_some(me.uid)));
|
||||
fields.add_field_method_get("gid", |_, me| Ok(me.is_dummy().not().then_some(me.gid)));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#[cfg(unix)]
|
||||
use mlua::{Function, Lua};
|
||||
|
||||
use super::Utils;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue