mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-20 23:11:24 +02:00
fix(single-instance): forward non-Unicode arguments and cwd (#3644)
* Update windows.rs * Create single-instance-non-unicode-args.md * fix on linux and windows too --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
1 parent
677258138b
commit
323fe80df1
5 files changed
+24
-11
No files matched your search
@@ -80,12 +80,14 @@ fn notify_singleton(socket: &PathBuf) -> Result<(), Error> {
|
||||
let mut bf = BufWriter::new(&stream);
|
||||
let cwd = std::env::current_dir()
|
||||
.unwrap_or_default()
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
bf.write_all(cwd.as_bytes())?;
|
||||
bf.write_all(b"\0\0")?;
|
||||
let args_joined = std::env::args().collect::<Vec<String>>().join("\0");
|
||||
let args_joined = std::env::args_os()
|
||||
.map(|arg| arg.to_string_lossy().into_owned())
|
||||
.collect::<Vec<String>>()
|
||||
.join("\0");
|
||||
bf.write_all(args_joined.as_bytes())?;
|
||||
bf.flush()?;
|
||||
drop(bf);
|
||||
|
||||
Reference in new issue
Block a user