mirror of
https://github.com/sxyazi/yazi.git
synced 2024-11-24 01:48:00 +03:00
fix: build error on linux
This commit is contained in:
parent
2d76eaf896
commit
311ca77fda
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1847,6 +1847,7 @@ version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542"
|
||||
dependencies = [
|
||||
"indexmap 2.0.0",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
|
@ -24,8 +24,8 @@ serde = { version = "^1", features = [ "derive" ] }
|
||||
serde_json = "^1"
|
||||
signal-hook-tokio = { version = "^0", features = [ "futures-v0_3" ] }
|
||||
syntect = "^5"
|
||||
tokio = { version = "^1", features = [ "parking_lot", "macros", "rt-multi-thread", "sync", "fs", "process", "io-std", "io-util", "time" ] }
|
||||
toml = "^0"
|
||||
tokio = { version = "^1", features = [ "parking_lot", "macros", "rt-multi-thread", "sync", "fs", "process", "io-std", "io-util" ] }
|
||||
toml = { version = "^0", features = [ "preserve_order" ] }
|
||||
tracing = "^0"
|
||||
tracing-appender = "^0"
|
||||
tracing-subscriber = "^0"
|
||||
|
11
build.sh
Executable file
11
build.sh
Executable file
@ -0,0 +1,11 @@
|
||||
cargo build --release --target aarch64-apple-darwin
|
||||
cargo build --release --target x86_64-apple-darwin
|
||||
cargo build --release --target x86_64-unknown-linux-gnu
|
||||
|
||||
mv target/aarch64-apple-darwin/release/yazi target/yazi-aarch64-apple-darwin
|
||||
mv target/x86_64-apple-darwin/release/yazi target/yazi-x86_64-apple-darwin
|
||||
mv target/x86_64-unknown-linux-gnu/release/yazi target/yazi-x86_64-unknown-linux-gnu
|
||||
|
||||
zip -j yazi-aarch64-apple-darwin.zip target/yazi-aarch64-apple-darwin
|
||||
zip -j yazi-x86_64-apple-darwin.zip target/yazi-x86_64-apple-darwin
|
||||
zip -j yazi-x86_64-unknown-linux-gnu.zip target/yazi-x86_64-unknown-linux-gnu
|
@ -15,43 +15,41 @@ impl Preset {
|
||||
continue;
|
||||
};
|
||||
|
||||
if k == "icons" {
|
||||
if k == "icons" || max <= 1 {
|
||||
continue;
|
||||
}
|
||||
|
||||
if max - 1 > 0 {
|
||||
if let Some(a) = a.as_table_mut() {
|
||||
if let Some(b) = v.as_table() {
|
||||
if let Some(a) = a.as_table_mut() {
|
||||
Self::merge(a, b, max - 1);
|
||||
continue;
|
||||
}
|
||||
Self::merge(a, b, max - 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
*a = v.clone();
|
||||
}
|
||||
}
|
||||
|
||||
fn merge_str(base: &str, user: &str) -> String {
|
||||
fn merge_str(user: &str, base: &str) -> String {
|
||||
let path = BaseDirectories::new().unwrap().get_config_file(user);
|
||||
let user = fs::read_to_string(path).unwrap_or("".to_string()).parse::<Table>().unwrap();
|
||||
let mut user = fs::read_to_string(path).unwrap_or("".to_string()).parse::<Table>().unwrap();
|
||||
|
||||
let mut base = base.parse::<Table>().unwrap();
|
||||
Self::merge(&mut base, &user, 2);
|
||||
base.to_string()
|
||||
let base = base.parse::<Table>().unwrap();
|
||||
Self::merge(&mut user, &base, 2);
|
||||
user.to_string()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn keymap() -> String {
|
||||
Self::merge_str(include_str!("../../config/keymap.toml"), "yazi/keymap.toml")
|
||||
Self::merge_str("yazi/keymap.toml", include_str!("../../config/keymap.toml"))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn theme() -> String {
|
||||
Self::merge_str(include_str!("../../config/theme.toml"), "yazi/theme.toml")
|
||||
Self::merge_str("yazi/theme.toml", include_str!("../../config/theme.toml"))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn yazi() -> String {
|
||||
Self::merge_str(include_str!("../../config/yazi.toml"), "yazi/yazi.toml")
|
||||
Self::merge_str("yazi/yazi.toml", include_str!("../../config/yazi.toml"))
|
||||
}
|
||||
}
|
||||
|
2
src/core/external/lsar.rs
vendored
2
src/core/external/lsar.rs
vendored
@ -4,7 +4,6 @@ use anyhow::{bail, Result};
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use tokio::process::Command;
|
||||
use tracing::info;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LsarAttr {
|
||||
@ -45,7 +44,6 @@ pub async fn lsar(path: &Path) -> Result<Vec<LsarFile>> {
|
||||
}
|
||||
|
||||
let output = String::from_utf8_lossy(&output.stdout);
|
||||
info!("lsar output: {}", output);
|
||||
let contents = serde_json::from_str::<Outer>(output.trim())?.contents;
|
||||
|
||||
let mut files = Vec::with_capacity(contents.len());
|
||||
|
@ -172,11 +172,11 @@ impl Folder {
|
||||
}
|
||||
|
||||
pub fn paginate(&self) -> &Slice<PathBuf, File> {
|
||||
let max = self.files.len().saturating_sub(1);
|
||||
let len = self.files.len();
|
||||
let limit = Self::limit();
|
||||
|
||||
let start = (self.page * limit).min(max);
|
||||
let end = (start + limit).min(max);
|
||||
let start = (self.page * limit).min(len.saturating_sub(1));
|
||||
let end = (start + limit).min(len);
|
||||
self.files.get_range(start..end).unwrap()
|
||||
}
|
||||
|
||||
|
@ -170,9 +170,11 @@ impl Tab {
|
||||
true
|
||||
}
|
||||
|
||||
pub fn back(&mut self) -> bool { todo!() }
|
||||
// TODO
|
||||
pub fn back(&mut self) -> bool { false }
|
||||
|
||||
pub fn forward(&mut self) -> bool { todo!() }
|
||||
// TODO
|
||||
pub fn forward(&mut self) -> bool { false }
|
||||
|
||||
pub fn search(&mut self, grep: bool) -> bool {
|
||||
if let Some(handle) = self.search.take() {
|
||||
|
@ -4,7 +4,6 @@ use anyhow::Result;
|
||||
use futures::{future::BoxFuture, FutureExt};
|
||||
use tokio::{fs, io::{self, ErrorKind::{AlreadyExists, NotFound}}, sync::mpsc};
|
||||
use tracing::{info, trace};
|
||||
use trash::{macos::{DeleteMethod, TrashContextExtMacos}, TrashContext};
|
||||
|
||||
use super::TaskOp;
|
||||
use crate::misc::{calculate_size, copy_with_progress};
|
||||
@ -142,6 +141,7 @@ impl File {
|
||||
FileOp::Trash(task) => {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
use trash::{macos::{DeleteMethod, TrashContextExtMacos}, TrashContext};
|
||||
let mut ctx = TrashContext::default();
|
||||
ctx.set_delete_method(DeleteMethod::NsFileManager);
|
||||
ctx.delete(&task.target)?;
|
||||
|
@ -90,9 +90,14 @@ impl Tasks {
|
||||
running.values().take(Self::limit()).cloned().collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub fn cancel(&self) -> bool {
|
||||
pub fn cancel(&mut self) -> bool {
|
||||
let id = self.scheduler.running.read().values().skip(self.cursor).next().map(|t| t.id);
|
||||
id.map(|id| self.scheduler.cancel(id)).unwrap_or(false)
|
||||
if !id.map(|id| self.scheduler.cancel(id)).unwrap_or(false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.next();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn file_open(&self, targets: &[(impl AsRef<Path>, impl AsRef<str>)]) -> bool {
|
||||
|
@ -101,7 +101,11 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver<Result<u64,
|
||||
pub fn file_mode(mode: u32) -> String {
|
||||
use libc::{S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let m = mode as u16;
|
||||
#[cfg(target_os = "linux")]
|
||||
let m = mode;
|
||||
|
||||
let mut s = String::with_capacity(10);
|
||||
|
||||
// File type
|
||||
|
@ -24,7 +24,6 @@ impl<'a> Widget for Progress<'a> {
|
||||
format!("{:>3}%, {} left", progress.0, progress.1),
|
||||
THEME.progress.label.get(),
|
||||
))
|
||||
.use_unicode(true)
|
||||
.render(area, buf);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user