Skip to content

Commit d197d89

Browse files
committed
2.1.1 - Path Bugs
1 parent b253c5b commit d197d89

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

Cargo.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wooting-profile-switcher"
33
description = "Wooting Profile Switcher"
4-
version = "2.1.0"
4+
version = "2.1.1"
55
authors = ["Shayne Hartford <shaybox@shaybox.com>", "Tony Langhammer"]
66
edition = "2021"
77
readme = "README.md"

Tauri.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
productName = "wooting-profile-switcher"
3-
version = "2.1.0"
3+
version = "2.1.1"
44

55
[tauri.bundle]
66
active = true

src/app.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::ops::Not;
2+
13
use egui_extras::{Column, TableBuilder};
24
use game_scanner::prelude::*;
35
use image::DynamicImage;
@@ -65,10 +67,26 @@ impl SelectedRule {
6567
fn to_rule(&self) -> Rule {
6668
Rule {
6769
alias: self.alias.clone(),
68-
match_app_name: Some(self.match_app_name.clone()),
69-
match_bin_name: Some(self.match_bin_name.clone()),
70-
match_bin_path: Some(self.match_bin_path.clone()),
71-
match_win_name: Some(self.match_win_name.clone()),
70+
match_app_name: self
71+
.match_app_name
72+
.is_empty()
73+
.not()
74+
.then_some(self.match_app_name.clone()),
75+
match_bin_name: self
76+
.match_bin_name
77+
.is_empty()
78+
.not()
79+
.then_some(self.match_bin_name.clone()),
80+
match_bin_path: self
81+
.match_bin_path
82+
.is_empty()
83+
.not()
84+
.then_some(self.match_bin_path.clone()),
85+
match_win_name: self
86+
.match_win_name
87+
.is_empty()
88+
.not()
89+
.then_some(self.match_win_name.clone()),
7290
profile_index: self.profile_index,
7391
}
7492
}
@@ -255,7 +273,7 @@ impl App for MainApp {
255273
alias: game.name,
256274
match_bin_path: game
257275
.path
258-
.map(|path| path.display().to_string()),
276+
.map(|path| path.display().to_string() + "*"),
259277
..Default::default()
260278
};
261279
config.rules.push(rule.clone());
@@ -266,6 +284,10 @@ impl App for MainApp {
266284
*open_new_rule_setup = false;
267285
}
268286
}
287+
288+
if ui.button("Cancel").clicked() {
289+
*open_new_rule_setup = false;
290+
}
269291
});
270292
});
271293
};

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ fn find_match(active_window: ActiveWindow, rules: Vec<Rule>) -> Option<u8> {
301301
for (rule_prop_fn, active_prop) in match_active_window {
302302
if let Some(rule) = rules.iter().cloned().find(|rule| {
303303
if let Some(rule_prop) = rule_prop_fn(rule.clone()) {
304-
if Pattern::new(&rule_prop).matches(&active_prop) {
304+
if Pattern::new(&rule_prop.replace('\\', "\\\\")).matches(&active_prop) {
305305
true
306306
} else if let Ok(re) = Regex::new(&rule_prop) {
307307
re.is_match(&active_prop)

0 commit comments

Comments
 (0)