Resolve init file write error
Was originally trying to create a text file in the /dev path, which is not possible. Have now used string parsing to resolve this issue.
This commit is contained in:
parent
7f3e4326ea
commit
980a8432e6
2 changed files with 14 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -639,7 +639,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "seymour_poc_rust"
|
name = "seymour_poc_rust"
|
||||||
version = "2.0.1"
|
version = "2.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
14
src/tty.rs
14
src/tty.rs
|
@ -78,8 +78,20 @@ pub struct TTY{
|
||||||
}
|
}
|
||||||
impl std::fmt::Debug for TTY{
|
impl std::fmt::Debug for TTY{
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result{
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result{
|
||||||
|
let absolute_location = self.tty.name();
|
||||||
|
let relative_location:String;
|
||||||
|
match absolute_location{
|
||||||
|
Some(abs_location_string) => {
|
||||||
|
let sectioned_abs_location = abs_location_string.rsplit_once('/');
|
||||||
|
match sectioned_abs_location{
|
||||||
|
Some((_,serial_device_name)) => relative_location = serial_device_name.to_string(),
|
||||||
|
None => relative_location = "unknown".to_string()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => relative_location = "unknown".to_string()
|
||||||
|
};
|
||||||
f.debug_struct("TTY")
|
f.debug_struct("TTY")
|
||||||
.field("Serial port name",&self.tty.name().unwrap_or("Unknown".to_string()))
|
.field("Serial port name",&relative_location)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue