From 111fcf188e9f4779d159a9700aa1d0829296a3eb Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Tue, 19 Nov 2019 18:46:47 +1300 Subject: [PATCH] Add umask to unix --full list --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/data/files.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 90b053ddea..7fe2bcd352 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1675,6 +1675,7 @@ dependencies = [ "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "trash 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "umask 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2735,6 +2736,11 @@ name = "typenum" version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "umask" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicase" version = "2.6.0" @@ -3381,6 +3387,7 @@ dependencies = [ "checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf" "checksum trash 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f24d31505f49e989b1ee2c03c323251f6763d5907d471b71192dac92e323f8" "checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +"checksum umask 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "d3ec2e5aeb4aadd510db9124513a7fec4a9c3a331b7f57aa519440dab3707067" "checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "09c8070a9942f5e7cfccd93f490fdebd230ee3c3c9f107cb25bad5351ef671cf" diff --git a/Cargo.toml b/Cargo.toml index 556d68ed9e..577a81066c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,6 +78,7 @@ regex = "1" cfg-if = "0.1" strip-ansi-escapes = "0.1.0" calamine = "0.16" +umask = "0.1" neso = { version = "0.5.0", optional = true } crossterm = { version = "0.10.2", optional = true } diff --git a/src/data/files.rs b/src/data/files.rs index 1e565ece37..d89887463c 100644 --- a/src/data/files.rs +++ b/src/data/files.rs @@ -37,7 +37,8 @@ pub(crate) fn dir_entry_dict( #[cfg(unix)] { use std::os::unix::fs::PermissionsExt; - dict.insert("mode", Value::int(metadata.permissions().mode())); + let mode = metadata.permissions().mode(); + dict.insert("mode", Value::string(umask::Mode::from(mode).to_string())); } }