mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
fix: Epic client imports get the launch command, versioned installs need a matching manifest build
Games the Epic client installed now carry their LaunchCommand arguments too, split by a new launch.split op. A doubled quote inside a quoted argument is one literal quote, and an install with a version ignores a manifest without the same build.
This commit is contained in:
1 parent
42026b382f
commit
b0e405ebf3
4 files changed
+20
-4
No files matched your search
@@ -160,6 +160,7 @@ synchronous on the calling thread (network calls block: call them off the main t
|
||||
| `cloud.list` | `accessToken`, `accountId`, `appName` | `files[]` of `name`, `modified` (ms, -1 unknown), `hash`, `readLink` |
|
||||
| `cloud.writeLinks` | `accessToken`, `accountId`, `appName`, `names[]` | `links`: name → write link |
|
||||
| `launch.args` | `displayName`, `accountId`, `namespace`, `locale`, `appName`, `deploymentId`, `additional` | `args[]` |
|
||||
| `launch.split` | `command` | `args[]` |
|
||||
| `locale` | `language`, `region` | `key`, `tags[]`, `launchLocale` |
|
||||
|
||||
`nativeFetch` ops: `manifest.download` (`info`, optional `cdns`) → the manifest bytes;
|
||||
|
||||
@@ -45,7 +45,8 @@ pub fn split_command(command: &str) -> Vec<String> {
|
||||
let mut quoted = false;
|
||||
let mut started = false;
|
||||
let mut slashes = 0usize;
|
||||
for c in command.chars().map(|c| if c == '\t' { ' ' } else { c }).filter(|&c| c >= ' ' && c != '\u{7f}') {
|
||||
let mut chars = command.chars().map(|c| if c == '\t' { ' ' } else { c }).filter(|&c| c >= ' ' && c != '\u{7f}').peekable();
|
||||
while let Some(c) = chars.next() {
|
||||
if c == '\\' {
|
||||
slashes += 1;
|
||||
started = true;
|
||||
@@ -55,6 +56,9 @@ pub fn split_command(command: &str) -> Vec<String> {
|
||||
current.extend(std::iter::repeat('\\').take(slashes / 2));
|
||||
if slashes % 2 == 1 {
|
||||
current.push('"');
|
||||
} else if quoted && chars.peek() == Some(&'"') {
|
||||
chars.next();
|
||||
current.push('"');
|
||||
} else {
|
||||
quoted = !quoted;
|
||||
}
|
||||
@@ -97,6 +101,7 @@ mod tests {
|
||||
split_command(r#"-name="a\" b" -dir=C:\Games\ "-q=\\" -r"#),
|
||||
vec![r#"-name=a" b"#, r"-dir=C:\Games\", r"-q=\", "-r"]
|
||||
);
|
||||
assert_eq!(split_command("-name=\"a\"\" b\" -s=\"\"\""), vec!["-name=a\" b", "-s=\""]);
|
||||
assert!(split_command(" ").is_empty());
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ fn dispatch(op: &str, req: &Value) -> Value {
|
||||
};
|
||||
json!({ "args": launch::arguments(&data) })
|
||||
}
|
||||
"launch.split" => json!({ "args": launch::split_command(str_of(req, "command")) }),
|
||||
"locale" => {
|
||||
let key = locale::language_key(str_of(req, "language"), str_of(req, "region"));
|
||||
json!({ "key": key, "tags": locale::tags_for_key(key), "launchLocale": locale::launch_locale(key) })
|
||||
@@ -192,6 +193,8 @@ mod tests {
|
||||
assert!(v["error"].is_string());
|
||||
let v: Value = serde_json::from_str(&call("launch.args", r#"{"namespace":"ns","appName":"A"}"#)).unwrap();
|
||||
assert_eq!(v["args"][0], "-EpicPortal");
|
||||
let v: Value = serde_json::from_str(&call("launch.split", r#"{"command":"-PCStore=EGS \"-log=a b.txt\""}"#)).unwrap();
|
||||
assert_eq!(v["args"], json!(["-PCStore=EGS", "-log=a b.txt"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user