https://github.com/cad97/win-ftype
https://github.com/cad97/win-ftype
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/cad97/win-ftype
- Owner: CAD97
- Created: 2022-09-08T00:24:40.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-08T00:53:02.000Z (almost 4 years ago)
- Last Synced: 2025-01-24T16:10:23.254Z (over 1 year ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This crate is 100% empty on non-windows platforms.
## Demo
(in Command Prompt)
```text
D:\git\cad97\win-ftype>cargo run -q -- test.py hi ma
[src\main.rs:11] cmd.with_file_type_association()? = "C:\\Windows\\py.exe" "D:\\git\\cad97\\win-ftype\\test.py" "hi" "ma"
['D:\\git\\cad97\\win-ftype\\test.py', 'hi', 'ma']
D:\git\cad97\win-ftype>test.py hi ma
['D:\\git\\cad97\\win-ftype\\test.py', 'hi', 'ma']
```
## Limitations
Necessarily reimplements the ["command line variables"](https://superuser.com/a/473602)
used in defining file type associations, so behavior may differ from `ShellExecute` there.
The most used placeholders of `%0`/`$1`/`%L` and `%*` should mostly work properly.
However, this implementation only does substitution for the *entire* argument; e.g.
an argument of `/z"%1"` won't get substituted properly. Everything else is a best-effort
implementation of mostly undocumented functionality.
Additionally, this crate *does not* replicate the "functionality" of unquoted variables
being expanded into potentially multiple command line arguments. This is primarily due
to the fact that after doing `CommandLineToArgvW` we lose the information of whether the
variable was quoted or not; we assume the proper quoting was used.