1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#![warn(missing_docs, rust_2018_idioms)]
pub mod assets;
pub mod config;
pub mod html;
pub mod platform;
#[derive(Debug, Clone)]
pub struct PackageInfo {
pub name: String,
pub version: String,
}
impl PackageInfo {
pub fn package_name(&self) -> String {
#[cfg(target_os = "linux")]
{
use heck::KebabCase;
self.name.to_kebab_case()
}
#[cfg(not(target_os = "linux"))]
return self.name.clone();
}
}
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("Unable to determine target-architecture")]
Architecture,
#[error("Unable to determine target-os")]
Os,
#[error("Unable to determine target-environment")]
Environment,
#[error("Unsupported platform for reading resources")]
UnsupportedPlatform,
#[error("Could not get parent process")]
ParentProcess,
#[error("Could not get parent PID")]
ParentPid,
#[error("Could not get child process")]
ChildProcess,
#[error("{0}")]
Io(#[from] std::io::Error),
}