File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ pub struct RunnerInfo {
18
18
name : String ,
19
19
version : String ,
20
20
directory : PathBuf ,
21
+ executable : PathBuf ,
21
22
}
22
23
23
24
impl RunnerInfo {
@@ -66,9 +67,15 @@ impl RunnerInfo {
66
67
Ok ( RunnerInfo {
67
68
name,
68
69
directory : directory. to_path_buf ( ) ,
70
+ executable : executable. to_path_buf ( ) ,
69
71
version,
70
72
} )
71
73
}
74
+
75
+ /// Get the full path to the executable for the runner
76
+ pub fn executable_path ( & self ) -> PathBuf {
77
+ self . directory . join ( & self . executable )
78
+ }
72
79
}
73
80
74
81
impl RunnerInfo {
@@ -89,13 +96,12 @@ impl RunnerInfo {
89
96
}
90
97
91
98
pub trait Runner {
92
- const EXECUTABLE : & ' static str ;
93
99
/// Get the common runner information
94
100
fn info ( & self ) -> & RunnerInfo ;
95
101
96
102
/// Check if the runner executable is available and functional
97
103
fn is_available ( & self ) -> bool {
98
- let executable_path = self . info ( ) . directory ( ) . join ( Self :: EXECUTABLE ) ;
104
+ let executable_path = self . info ( ) . executable_path ( ) ;
99
105
executable_path. exists ( ) && executable_path. is_file ( )
100
106
}
101
107
}
Original file line number Diff line number Diff line change @@ -13,14 +13,13 @@ impl TryFrom<&Path> for Proton {
13
13
type Error = Box < dyn std:: error:: Error > ;
14
14
15
15
fn try_from ( path : & Path ) -> Result < Self , Self :: Error > {
16
- let executable = PathBuf :: from ( Self :: EXECUTABLE ) ;
16
+ let executable = PathBuf :: from ( "./proton" ) ;
17
17
let info = RunnerInfo :: try_from ( path, & executable) ?;
18
18
Ok ( Proton { info } )
19
19
}
20
20
}
21
21
22
22
impl Runner for Proton {
23
- const EXECUTABLE : & ' static str = "proton" ;
24
23
fn info ( & self ) -> & RunnerInfo {
25
24
& self . info
26
25
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ impl TryFrom<&Path> for UMU {
11
11
type Error = Box < dyn std:: error:: Error > ;
12
12
13
13
fn try_from ( path : & Path ) -> Result < Self , Self :: Error > {
14
- let executable = PathBuf :: from ( Self :: EXECUTABLE ) ;
14
+ let executable = PathBuf :: from ( "./umu-run" ) ;
15
15
let mut info = RunnerInfo :: try_from ( path, & executable) ?;
16
16
let pretty_version = info
17
17
. version
@@ -28,7 +28,6 @@ impl TryFrom<&Path> for UMU {
28
28
}
29
29
30
30
impl Runner for UMU {
31
- const EXECUTABLE : & ' static str = "umu-run" ;
32
31
fn info ( & self ) -> & RunnerInfo {
33
32
& self . info
34
33
}
Original file line number Diff line number Diff line change @@ -21,14 +21,13 @@ impl TryFrom<&Path> for Wine {
21
21
type Error = Box < dyn std:: error:: Error > ;
22
22
23
23
fn try_from ( path : & Path ) -> Result < Self , Self :: Error > {
24
- let executable = PathBuf :: from ( Self :: EXECUTABLE ) ;
24
+ let executable = PathBuf :: from ( "./bin/wine" ) ;
25
25
let info = RunnerInfo :: try_from ( path, & executable) ?;
26
26
Ok ( Wine { info } )
27
27
}
28
28
}
29
29
30
30
impl Runner for Wine {
31
- const EXECUTABLE : & ' static str = "bin/wine" ;
32
31
fn info ( & self ) -> & RunnerInfo {
33
32
& self . info
34
33
}
You can’t perform that action at this time.
0 commit comments