better DLL/EXE support, fixed weird symlink semidemihemibug
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d54cc8d6da
commit
21dfe93a05
5 changed files with 28 additions and 13 deletions
|
@ -9,6 +9,7 @@ Dates are given in YYYY-MM-DD format.
|
||||||
- PKGBUILD for Arch-based distros
|
- PKGBUILD for Arch-based distros
|
||||||
- Added Text extension set
|
- Added Text extension set
|
||||||
- More test coverage
|
- More test coverage
|
||||||
|
- Fixed a very minor output bug relating to scanning symlinked directories
|
||||||
|
|
||||||
### v0.2.11 (2021-04-04)
|
### v0.2.11 (2021-04-04)
|
||||||
#### Features
|
#### Features
|
||||||
|
|
14
Cargo.lock
generated
14
Cargo.lock
generated
|
@ -79,9 +79,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-channel"
|
name = "crossbeam-channel"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
|
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
|
@ -250,9 +250,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "infer"
|
name = "infer"
|
||||||
version = "0.3.6"
|
version = "0.3.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0803735b9511d0956c68902a6513ca867819d6e43397adb6a5e903e2f09db734"
|
checksum = "865e8a58ae8e24d2c4412c31344afa1d302a3740ad67528c10f50d6876cdcf55"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "instant"
|
name = "instant"
|
||||||
|
@ -321,7 +321,7 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime_guess"
|
name = "mime_guess"
|
||||||
version = "2.0.4"
|
version = "2.0.4"
|
||||||
source = "git+https://github.com/Lynnesbian/mime_guess#679d3b8887d30bd43a83f162d61b7226675c7012"
|
source = "git+https://github.com/Lynnesbian/mime_guess#55fe99663a1b78ad5f50ffe1a9aaeb65fb2cb4ca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mime",
|
"mime",
|
||||||
"unicase",
|
"unicase",
|
||||||
|
@ -475,9 +475,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.2.5"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
|
checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -24,18 +24,18 @@ infer-backend = []
|
||||||
xdg-mime-backend = []
|
xdg-mime-backend = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
walkdir = "2.3.1"
|
walkdir = "2.3.2"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
mime_guess = "2.0.3"
|
mime_guess = "2.0.3"
|
||||||
snailquote = "0.3.0"
|
snailquote = "0.3.0"
|
||||||
once_cell = "1.5.2"
|
once_cell = "1.7.2"
|
||||||
infer = { version = "0.3.4" }
|
infer = "0.3.6"
|
||||||
rayon = { version = "1.5.0", optional = true }
|
rayon = { version = "1.5.0", optional = true }
|
||||||
exitcode = "1.1.2"
|
exitcode = "1.1.2"
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.0"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
xdg-mime = "0.3"
|
xdg-mime = "0.3.2"
|
||||||
|
|
||||||
[target.'cfg(not(all(target_endian = "big", target_pointer_width = "32")))'.dependencies]
|
[target.'cfg(not(all(target_endian = "big", target_pointer_width = "32")))'.dependencies]
|
||||||
smartstring = "0.2.6"
|
smartstring = "0.2.6"
|
||||||
|
@ -52,7 +52,7 @@ default-features = false
|
||||||
features = ["wrap_help", "color", "derive", "std"]
|
features = ["wrap_help", "color", "derive", "std"]
|
||||||
|
|
||||||
[dependencies.env_logger]
|
[dependencies.env_logger]
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["termcolor", "atty"]
|
features = ["termcolor", "atty"]
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,10 @@ cached! {
|
||||||
// neither xdg-mime nor infer seem to be able to detect office XML files properly...
|
// neither xdg-mime nor infer seem to be able to detect office XML files properly...
|
||||||
[vec![String::from("zip"), String::from("docx"), String::from("xlsx"), String::from("pptx")], possible_exts].concat()
|
[vec![String::from("zip"), String::from("docx"), String::from("xlsx"), String::from("pptx")], possible_exts].concat()
|
||||||
|
|
||||||
|
} else if mime == Mime::from_str("application/x-ms-dos-executable").unwrap() {
|
||||||
|
// both .dll and .exe files are given the same mime type... but you definitely don't want to rename one to the
|
||||||
|
// other!
|
||||||
|
[vec![String::from("dll"), String::from("exe")], possible_exts].concat()
|
||||||
} else {
|
} else {
|
||||||
possible_exts
|
possible_exts
|
||||||
})
|
})
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -15,6 +15,7 @@
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
#![warn(trivial_casts, unused_lifetimes, unused_qualifications)]
|
||||||
|
|
||||||
use std::io::{stdout, BufWriter};
|
use std::io::{stdout, BufWriter};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -301,7 +302,16 @@ fn scan_directory(dirs: &Path, exts: Option<&Vec<&str>>, scan_opts: &ScanOpts) -
|
||||||
}
|
}
|
||||||
e.ok()
|
e.ok()
|
||||||
})
|
})
|
||||||
.filter(|e| !e.file_type().is_dir()) // remove directories from the final list
|
// remove directories from the final list
|
||||||
|
.filter(|e| !e.file_type().is_dir())
|
||||||
|
// if fif is invoked without `-f` on a symlinked directory, it will recurse into the symlink (as desired) and ignore
|
||||||
|
// any symlinks inside the symlinked root directory. however, the root directory will still be added to `entries` as
|
||||||
|
// if it were a file to be scanned, and `scan_file` will fail to scan it, adding "Failed to read ~/whatever" to the
|
||||||
|
// output. to avoid this, we can remove all symlinks from `entries` if `-f` is not set. i know this is kind of
|
||||||
|
// confusing, but it's honestly kind of hard to explain... maybe a screenshot is better:
|
||||||
|
// https://i.imgur.com/DYG7jlB.png
|
||||||
|
// adding the symlink filter removes the line that's being pointed to in the image. 0u0
|
||||||
|
.filter(|e| scan_opts.follow_symlinks || !e.file_type().is_symlink())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if probably_fatal_error {
|
if probably_fatal_error {
|
||||||
|
|
Loading…
Reference in a new issue