mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-05 02:55:31 +00:00
add pseudocode for missing features
This commit is contained in:
parent
1c1588a327
commit
bac9fd57ec
@ -40,7 +40,7 @@ sevenz-rust2 = { version = "0.13.1", features = ["compress", "aes256"] }
|
||||
snap = "1.1.1"
|
||||
tar = "0.4.42"
|
||||
tempfile = "3.10.1"
|
||||
thiserror = "1.0.64"
|
||||
thiserror = "2.0.12"
|
||||
time = { version = "0.3.36", default-features = false }
|
||||
unrar = { version = "0.5.7", optional = true }
|
||||
xz2 = "0.1.7"
|
||||
|
39
src/main.rs
39
src/main.rs
@ -34,13 +34,6 @@ pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE;
|
||||
fn main() {
|
||||
spawn_logger_thread();
|
||||
|
||||
//restrict write permissions to the current workign directory
|
||||
let working_dir = get_current_working_dir().expect("Cannot get current working dir");
|
||||
let path_str = working_dir.to_str().expect("Cannot convert path");
|
||||
let status = sandbox::restrict_paths(&[path_str]).expect("failed to build the ruleset");
|
||||
|
||||
//todo: check status and report error or warning if landlock restriction failed
|
||||
|
||||
let result = run();
|
||||
shutdown_logger_and_wait();
|
||||
|
||||
@ -52,9 +45,41 @@ fn main() {
|
||||
|
||||
fn run() -> Result<()> {
|
||||
let (args, skip_questions_positively, file_visibility_policy) = CliArgs::parse_and_validate_args()?;
|
||||
|
||||
// check args if case A: "decompress -d <outputdir>" or case B: "decompress -r" is used
|
||||
//if true
|
||||
//Case A:
|
||||
// write_dirs = outputdir
|
||||
//Case B:
|
||||
// write_dir = inputdir
|
||||
|
||||
//init_sandbox( write_dirs );
|
||||
init_sandbox();
|
||||
|
||||
commands::run(args, skip_questions_positively, file_visibility_policy)
|
||||
}
|
||||
|
||||
// init_sandbox( write_dirs
|
||||
fn init_sandbox() {
|
||||
|
||||
//if empty write_dirs
|
||||
//{
|
||||
//restrict write permissions to the current workign directory
|
||||
let working_dir = get_current_working_dir().expect("Cannot get current working dir");
|
||||
let path_str = working_dir.to_str().expect("Cannot convert path");
|
||||
|
||||
//}
|
||||
//else
|
||||
//path_str = write_dirs;
|
||||
let status = sandbox::restrict_paths(&[path_str]).expect("failed to build the ruleset");
|
||||
//}
|
||||
|
||||
// todos:
|
||||
// check status and report error or warning if landlock restriction failed
|
||||
// add os detection to encapsulate this feature to be executed on linux only
|
||||
// add implementation for other OS
|
||||
}
|
||||
|
||||
fn get_current_working_dir() -> std::io::Result<PathBuf> {
|
||||
env::current_dir()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user