Better error messages
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
name = "redoxfs"
|
||||
description = "The Redox Filesystem"
|
||||
repository = "https://github.com/redox-os/redoxfs"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
license-file = "LICENSE"
|
||||
readme = "README.md"
|
||||
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
|
||||
|
||||
+13
-6
@@ -3,8 +3,7 @@
|
||||
extern crate redoxfs;
|
||||
extern crate syscall;
|
||||
|
||||
use std::env;
|
||||
use std::str;
|
||||
use std::{env, process, str};
|
||||
|
||||
use redoxfs::FileSystem;
|
||||
|
||||
@@ -19,13 +18,21 @@ fn main() {
|
||||
match Image::open(&path) {
|
||||
Ok(disk) => match FileSystem::create(Box::new(disk)) {
|
||||
Ok(filesystem) => {
|
||||
println!("redoxfs: created filesystem on {}, size {} MB", path, filesystem.header.1.size/1024/1024);
|
||||
println!("redoxfs-mkfs: created filesystem on {}, size {} MB", path, filesystem.header.1.size/1024/1024);
|
||||
},
|
||||
Err(err) => println!("redoxfs: failed to create filesystem on {}: {}", path, err)
|
||||
Err(err) => {
|
||||
println!("redoxfs-mkfs: failed to create filesystem on {}: {}", path, err);
|
||||
process::exit(1);
|
||||
}
|
||||
},
|
||||
Err(err) => println!("redoxfs: failed to open image {}: {}", path, err)
|
||||
Err(err) => {
|
||||
println!("redoxfs-mkfs: failed to open image {}: {}", path, err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println!("redoxfs: no disk image provided");
|
||||
println!("redoxfs-mkfs: no disk image provided");
|
||||
println!("redoxfs-mkfs [disk]");
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,10 @@ fn mount<P: AsRef<Path>>(filesystem: redoxfs::FileSystem, mountpoint: &P, write:
|
||||
redox::mount(filesystem, mountpoint, write);
|
||||
}
|
||||
|
||||
fn usage() {
|
||||
println!("redoxfs [disk] [mountpoint]");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
use std::io::{Read, Write};
|
||||
|
||||
@@ -106,6 +110,7 @@ fn main() {
|
||||
process::exit(0);
|
||||
} else {
|
||||
println!("redoxfs: no mount point provided");
|
||||
usage();
|
||||
}
|
||||
},
|
||||
Err(err) => println!("redoxfs: failed to open filesystem {}: {}", path, err)
|
||||
@@ -118,6 +123,7 @@ fn main() {
|
||||
process::exit(1);
|
||||
} else {
|
||||
println!("redoxfs: no disk image provided");
|
||||
usage();
|
||||
}
|
||||
} else if pid > 0 {
|
||||
drop(write);
|
||||
|
||||
Reference in New Issue
Block a user