aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/main.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 3a5f8a5..a24510e 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -41,16 +41,23 @@ impl MsRefreshTokenState {
}
/// Check if a string contains unresolved placeholders in the form ${...}
+///
+/// After the replacement phase, if a string still contains ${...}, it means
+/// that placeholder variable was not found in the replacements map and is
+/// therefore unresolved. We should skip adding such arguments to avoid
+/// passing malformed arguments to the game launcher.
fn has_unresolved_placeholder(s: &str) -> bool {
+ // Look for the opening sequence
if let Some(start_pos) = s.find("${") {
- // Check if there's a closing brace after the opening
- if let Some(end_pos) = s[start_pos..].find('}') {
- // Verify the closing brace is after the opening sequence
- return end_pos > 2; // "${" is 2 chars, so } must be after position 2
+ // Check if there's a closing brace after the opening sequence
+ if s[start_pos + 2..].find('}').is_some() {
+ // Found a complete ${...} pattern - this is an unresolved placeholder
+ return true;
}
- // Found opening but no closing brace - treat as unresolved
+ // Found ${ but no closing } - also treat as unresolved/malformed
return true;
}
+ // No ${ found - the string is fully resolved
false
}