diff options
| author | 2026-01-14 07:46:00 +0000 | |
|---|---|---|
| committer | 2026-01-14 07:46:00 +0000 | |
| commit | 4843a4fc5e4f97790aba1fa5cc3b4ad5ac55c220 (patch) | |
| tree | 058deda0e86ff12a16d9851fe76bcb38239acf26 /src-tauri/src | |
| parent | f8bf90421acce2c05ffedcee8e9b07f9adb96295 (diff) | |
| download | DropOut-4843a4fc5e4f97790aba1fa5cc3b4ad5ac55c220.tar.gz DropOut-4843a4fc5e4f97790aba1fa5cc3b4ad5ac55c220.zip | |
Add documentation to clarify placeholder detection logic
Co-authored-by: HsiangNianian <44714368+HsiangNianian@users.noreply.github.com>
Diffstat (limited to 'src-tauri/src')
| -rw-r--r-- | src-tauri/src/main.rs | 17 |
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 } |