|
1 | | -// Copyright 2022-2023, Collabora, Ltd. |
| 1 | +// Copyright 2022-2025, Collabora, Ltd. |
2 | 2 | // SPDX-License-Identifier: MIT OR Apache-2.0 |
3 | 3 |
|
4 | | -use xdg::{BaseDirectories, BaseDirectoriesError}; |
| 4 | +use xdg::BaseDirectories; |
5 | 5 |
|
6 | 6 | use crate::{ |
7 | 7 | manifest::{GenericManifest, FILE_INDIRECTION_ARROW}, |
@@ -47,10 +47,7 @@ impl LinuxRuntime { |
47 | 47 |
|
48 | 48 | impl PlatformRuntime for LinuxRuntime { |
49 | 49 | fn make_active(&self) -> Result<(), Error> { |
50 | | - fn convert_err(e: BaseDirectoriesError) -> Error { |
51 | | - Error::SetActiveError(e.to_string()) |
52 | | - } |
53 | | - let dirs = BaseDirectories::new().map_err(convert_err)?; |
| 50 | + let dirs = BaseDirectories::new(); |
54 | 51 | let suffix = make_path_suffix(); |
55 | 52 | let path = dirs.place_config_file(suffix.join(ACTIVE_RUNTIME_FILENAME))?; |
56 | 53 |
|
@@ -135,9 +132,8 @@ fn is_active_runtime_name(p: &Path) -> bool { |
135 | 132 | fn find_potential_manifests_xdg(suffix: &Path) -> impl Iterator<Item = PathBuf> { |
136 | 133 | let suffix = suffix.to_owned(); |
137 | 134 | BaseDirectories::new() |
138 | | - .ok() |
| 135 | + .list_config_files(&suffix) |
139 | 136 | .into_iter() |
140 | | - .flat_map(move |xdg_dirs| xdg_dirs.list_config_files(&suffix)) |
141 | 137 | .filter(|p| !is_active_runtime_name(p)) |
142 | 138 | } |
143 | 139 |
|
@@ -180,11 +176,7 @@ fn possible_active_runtimes() -> impl Iterator<Item = PathBuf> { |
180 | 176 | let etc_iter = once(make_sysconfdir(&suffix)); |
181 | 177 | // Warning: BaseDirectories returns increasing order of importance, which is |
182 | 178 | // opposite of what we want, so we reverse it. |
183 | | - let xdg_iter = BaseDirectories::new() |
184 | | - .ok() |
185 | | - .into_iter() |
186 | | - .flat_map(move |d| d.find_config_files(&suffix)) |
187 | | - .rev(); |
| 179 | + let xdg_iter = BaseDirectories::new().find_config_files(&suffix).rev(); |
188 | 180 |
|
189 | 181 | xdg_iter |
190 | 182 | .chain(etc_iter) |
|
0 commit comments