Remove merge conflicts

pull/477/head
Arijit Basu 2 years ago committed by Arijit Basu
parent 37e660e0a6
commit 8e1d16b751

File diff suppressed because it is too large Load Diff

@ -208,7 +208,6 @@ xplr.config.general.table.row.cols = {
-- Type: [Style](https://xplr.dev/en/style)
xplr.config.general.table.row.style = {}
<<<<<<< HEAD
-- Height of the table rows.
--
-- Type: nullable integer
@ -241,8 +240,8 @@ xplr.config.general.table.col_spacing = 1
-- Type: nullable list of [Constraint](https://xplr.dev/en/layouts#constraint)
xplr.config.general.table.col_widths = {
{ Percentage = 10 },
{ Percentage = 40 },
{ Percentage = 20 },
{ Percentage = 50 },
{ Percentage = 10 },
{ Percentage = 10 },
{ Percentage = 20 },
}

@ -1003,6 +1003,8 @@ pub enum NodeSorter {
ByIsReadonly,
ByMimeEssence,
BySize,
ByCreated,
ByLastModified,
ByCanonicalAbsolutePath,
ByICanonicalAbsolutePath,
@ -1012,6 +1014,8 @@ pub enum NodeSorter {
ByCanonicalIsReadonly,
ByCanonicalMimeEssence,
ByCanonicalSize,
ByCanonicalCreated,
ByCanonicalLastModified,
BySymlinkAbsolutePath,
ByISymlinkAbsolutePath,
@ -1021,6 +1025,8 @@ pub enum NodeSorter {
BySymlinkIsReadonly,
BySymlinkMimeEssence,
BySymlinkSize,
BySymlinkCreated,
BySymlinkLastModified,
}
#[derive(Debug, Clone, Eq, Serialize, Deserialize)]
@ -1065,6 +1071,8 @@ impl NodeSorterApplicable {
NodeSorter::ByIsReadonly => a.is_readonly.cmp(&b.is_readonly),
NodeSorter::ByMimeEssence => a.mime_essence.cmp(&b.mime_essence),
NodeSorter::BySize => a.size.cmp(&b.size),
NodeSorter::ByCreated => a.created.cmp(&b.created),
NodeSorter::ByLastModified => a.last_modified.cmp(&b.last_modified),
NodeSorter::ByCanonicalAbsolutePath => natord::compare(
&a.canonical
@ -1126,6 +1134,18 @@ impl NodeSorterApplicable {
.map(|s| &s.size)
.cmp(&b.canonical.as_ref().map(|s| &s.size)),
NodeSorter::ByCanonicalCreated => a
.canonical
.as_ref()
.map(|s| &s.created)
.cmp(&b.canonical.as_ref().map(|s| &s.created)),
NodeSorter::ByCanonicalLastModified => a
.canonical
.as_ref()
.map(|s| &s.last_modified)
.cmp(&b.canonical.as_ref().map(|s| &s.last_modified)),
NodeSorter::BySymlinkAbsolutePath => natord::compare(
&a.symlink
.as_ref()
@ -1183,6 +1203,18 @@ impl NodeSorterApplicable {
.as_ref()
.map(|s| &s.size)
.cmp(&b.symlink.as_ref().map(|s| &s.size)),
NodeSorter::BySymlinkCreated => a
.symlink
.as_ref()
.map(|s| &s.created)
.cmp(&b.symlink.as_ref().map(|s| &s.created)),
NodeSorter::BySymlinkLastModified => a
.symlink
.as_ref()
.map(|s| &s.last_modified)
.cmp(&b.symlink.as_ref().map(|s| &s.last_modified)),
};
if self.reverse {
order.reverse()

@ -3,8 +3,9 @@ use humansize::{file_size_opts as options, FileSize};
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::path::{Path, PathBuf};
use std::time::UNIX_EPOCH;
fn to_humansize(size: u64) -> String {
fn to_human_size(size: u64) -> String {
size.file_size(options::CONVENTIONAL)
.unwrap_or_else(|_| format!("{} B", size))
}
@ -30,6 +31,8 @@ pub struct ResolvedNode {
pub mime_essence: String,
pub size: u64,
pub human_size: String,
pub created: Option<u64>,
pub last_modified: Option<u64>,
}
impl ResolvedNode {
@ -39,15 +42,28 @@ impl ResolvedNode {
.map(|e| e.to_string_lossy().to_string())
.unwrap_or_default();
let (is_dir, is_file, is_readonly, size) = path
let (is_dir, is_file, is_readonly, size, created, last_modified) = path
.metadata()
.map(|m| {
(m.is_dir(), m.is_file(), m.permissions().readonly(), m.len())
(
m.is_dir(),
m.is_file(),
m.permissions().readonly(),
m.len(),
m.created()
.ok()
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
.map(|d| d.as_secs()),
m.modified()
.ok()
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
.map(|d| d.as_secs()),
)
})
.unwrap_or((false, false, false, 0));
.unwrap_or((false, false, false, 0, None, None));
let mime_essence = mime_essence(&path, is_dir);
let human_size = to_humansize(size);
let human_size = to_human_size(size);
Self {
absolute_path: path.to_string_lossy().to_string(),
@ -58,6 +74,8 @@ impl ResolvedNode {
mime_essence,
size,
human_size,
created,
last_modified,
}
}
}
@ -77,6 +95,9 @@ pub struct Node {
pub size: u64,
pub human_size: String,
pub permissions: Permissions,
pub created: Option<u64>,
pub last_modified: Option<u64>,
pub canonical: Option<ResolvedNode>,
pub symlink: Option<ResolvedNode>,
}
@ -100,24 +121,50 @@ impl Node {
.map(|p| (false, Some(ResolvedNode::from(p))))
.unwrap_or_else(|_| (true, None));
let (is_symlink, is_dir, is_file, is_readonly, size, permissions) =
path.symlink_metadata()
.map(|m| {
(
m.file_type().is_symlink(),
m.is_dir(),
m.is_file(),
m.permissions().readonly(),
m.len(),
Permissions::from(&m),
)
})
.unwrap_or_else(|_| {
(false, false, false, false, 0, Permissions::default())
});
let (
is_symlink,
is_dir,
is_file,
is_readonly,
size,
permissions,
created,
last_modified,
) = path
.symlink_metadata()
.map(|m| {
(
m.file_type().is_symlink(),
m.is_dir(),
m.is_file(),
m.permissions().readonly(),
m.len(),
Permissions::from(&m),
m.created()
.ok()
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
.map(|d| d.as_secs()),
m.modified()
.ok()
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
.map(|d| d.as_secs()),
)
})
.unwrap_or_else(|_| {
(
false,
false,
false,
false,
0,
Permissions::default(),
None,
None,
)
});
let mime_essence = mime_essence(&path, is_dir);
let human_size = to_humansize(size);
let human_size = to_human_size(size);
Self {
parent,
@ -133,6 +180,8 @@ impl Node {
size,
human_size,
permissions,
created,
last_modified,
canonical: maybe_canonical_meta.clone(),
symlink: if is_symlink {
maybe_canonical_meta

@ -375,10 +375,8 @@ pub struct ResolvedNodeUiMetadata {
pub mime_essence: String,
pub size: u64,
pub human_size: String,
pub created: Option<i64>,
pub human_created: String,
pub last_modified: Option<i64>,
pub human_last_modified: String,
pub created: Option<u64>,
pub last_modified: Option<u64>,
}
impl From<ResolvedNode> for ResolvedNodeUiMetadata {
@ -393,9 +391,7 @@ impl From<ResolvedNode> for ResolvedNodeUiMetadata {
size: node.size,
human_size: node.human_size,
created: node.created,
human_created: node.human_created,
last_modified: node.last_modified.to_owned(),
human_last_modified: node.human_last_modified,
}
}
}
@ -418,10 +414,8 @@ pub struct NodeUiMetadata {
pub permissions: Permissions,
pub canonical: Option<ResolvedNodeUiMetadata>,
pub symlink: Option<ResolvedNodeUiMetadata>,
pub created: Option<i64>,
pub human_created: String,
pub last_modified: Option<i64>,
pub human_last_modified: String,
pub created: Option<u64>,
pub last_modified: Option<u64>,
// Extra
pub index: usize,
@ -469,9 +463,7 @@ impl NodeUiMetadata {
canonical: node.canonical.to_owned().map(ResolvedNode::into),
symlink: node.symlink.to_owned().map(ResolvedNode::into),
created: node.created,
human_created: node.human_created.to_owned(),
last_modified: node.last_modified,
human_last_modified: node.human_last_modified.to_owned(),
index,
relative_index,
is_before_focus,

Loading…
Cancel
Save