Skip to content

Commit

Permalink
add fake folders mathod on win
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Feb 28, 2025
1 parent 9466e38 commit 5b7291a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 21 additions & 6 deletions crates/rattler_menuinst/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct Directories {
start_menu: PathBuf,
quick_launch: Option<PathBuf>,
desktop: PathBuf,
pub known_folders: knownfolders::Folders,
windows_terminal_settings_files: Vec<PathBuf>,
}

fn shortcut_filename(name: &str, env_name: Option<&String>, ext: Option<&str>) -> String {
Expand Down Expand Up @@ -75,11 +75,29 @@ impl Directories {
.get_folder_path(Folder::Desktop, user_handle)
.unwrap();

let windows_terminal_settings_files =
terminal::windows_terminal_settings_files(menu_mode, &known_folders);

Directories {
start_menu,
quick_launch,
desktop,
known_folders,
windows_terminal_settings_files,
}
}

/// Create a fake Directories struct for testing ONLY
pub fn fake_folders(path: &Path) -> Directories {
let terminal_settings_json = path.join("terminal_settings.json");
if !terminal_settings_json.exists() {
// This is for testing only, so we can ignore the result
std::fs::write(&terminal_settings_json, "{}").unwrap();
}
Directories {
start_menu: path.join("Start Menu"),
quick_launch: Some(path.join("Quick Launch")),
desktop: path.join("Desktop"),
windows_terminal_settings_files: vec![terminal_settings_json],
}
}
}
Expand Down Expand Up @@ -454,10 +472,7 @@ impl WindowsMenu {
.map(|s| s.resolve(&self.placeholders)),
};

for location in terminal::windows_terminal_settings_files(
self.menu_mode,
&self.directories.known_folders,
) {
for location in &self.directories.windows_terminal_settings_files {
terminal::add_windows_terminal_profile(&location, &profile)?;
tracker.terminal_profiles.push(WindowsTerminalProfile {
configuration_file: location,

Check failure on line 478 in crates/rattler_menuinst/src/windows.rs

View workflow job for this annotation

GitHub Actions / Windows-x86_64

mismatched types

Check failure on line 478 in crates/rattler_menuinst/src/windows.rs

View workflow job for this annotation

GitHub Actions / Windows-aarch64

mismatched types
Expand Down

0 comments on commit 5b7291a

Please sign in to comment.