@@ -47,6 +47,7 @@ pub async fn server(containers: Vec<(String, ContainerType)>) -> Result<(), Serv
47
47
log:: error!( "Error setting up client {}: {:?}" , container_name, kind) ;
48
48
}
49
49
}
50
+ let _ = fs:: remove_dir_all ( Path :: new ( "/tmp/container-desktop-entries/" ) ) ;
50
51
loop {
51
52
// Busy wait until logging off, keeping the desktop entries alive
52
53
std:: future:: pending :: < ( ) > ( ) . await ;
@@ -59,15 +60,8 @@ async fn set_up_client(
59
60
) -> Result < ( ) , ClientSetupError > {
60
61
// Start client if client is not running
61
62
start_client ( container_name, container_type) ?;
62
- let to_path_str = match env:: var ( "RUNTIME_DIRECTORY" ) {
63
- Ok ( h) => h,
64
- Err ( _) => {
65
- log:: error!( "RUNTIME_DIRECTORY NOT FOUND. Make sure you're using the service!" ) ;
66
- panic ! ( )
67
- }
68
- } ;
69
63
70
- let to_path = Path :: new ( & to_path_str ) ;
64
+ let to_path = Path :: new ( "/tmp/container-desktop-entries/" ) ;
71
65
if !to_path. exists ( ) {
72
66
log:: warn!(
73
67
"Runtime directory {} does not exist! Attempting to create directory manually..." ,
@@ -119,9 +113,9 @@ async fn set_up_client(
119
113
let name_regex = Regex :: new ( container_type. format_name_regex_pattern ( ) . as_str ( ) ) . unwrap ( ) ;
120
114
121
115
for entry_path in fs:: read_dir ( to_path. join ( "applications" ) ) . unwrap ( ) {
122
- let path = entry_path. unwrap ( ) . path ( ) ;
123
- log:: debug!( "Looking at path: {:?}" , path ) ;
124
- match read_to_string ( & path ) {
116
+ let path_buf = entry_path. unwrap ( ) . path ( ) ;
117
+ log:: debug!( "Looking at path: {:?}" , path_buf ) ;
118
+ match read_to_string ( & path_buf ) {
125
119
Ok ( file_text) => {
126
120
// run regex on it now
127
121
let file_text = exec_regex
@@ -137,7 +131,7 @@ async fn set_up_client(
137
131
)
138
132
. to_string ( ) ;
139
133
140
- match DesktopEntry :: decode ( & path , & file_text) {
134
+ match DesktopEntry :: decode ( & path_buf , & file_text) {
141
135
Ok ( entry) => {
142
136
// We have a valid desktop entry
143
137
if entry. no_display ( ) {
@@ -197,7 +191,7 @@ async fn set_up_client(
197
191
Err ( e) => {
198
192
log:: error!(
199
193
"Could not read path {:?} to string. Reason: {}" ,
200
- path ,
194
+ path_buf ,
201
195
e. to_string( )
202
196
) ;
203
197
}
0 commit comments