plat/win_shell.rs (Windows)#
Source: lib/plat/win_shell.rs
win_shell -- the shell and process level: open a folder / a URL, the system theme, the home
folder, the drives, start this program again
[src/plat/win/win_shell.s, win_files.s (home, drives), plat_win.s
(theme, spawn_self)]
open_folder(path) -> 0 started, -1 failed (no such path, no shell32, error)
path: UTF-8, '/' or '\' separators. A folder opens in Explorer (ShellExecuteW "open"
on the folder); a file is shown selected in its folder (ShellExecuteW "open"
explorer.exe with /select,"path"). shell32 and ole32 are loaded at run time (COM
initialised once, as for the file dialog). jfgui_OPEN_DRYRUN=1: nothing is started;
the call is printed to stdout and 0 returned (tests).
open_url(url) -> 0 / -1 a web page (http / https / mailto ...) in the default
application (ShellExecuteW "open" on the URL); the same dry run
settings_open(page) -> bool (assoc.rs) a page of Settings (ms-settings:...); the same dry run
theme() -> 0 light, 1 dark, -1 unknown (HKCU ... Personalize\AppsUseLightTheme)
home() -> %USERPROFILE% (or "C:/") drives() -> "C:/", "D:/", ...
spawn_self(args) -> 0 / -1 this executable again: "exe" "arg1" "arg2" ... (every
argument quoted with the Microsoft rules), no inherited handles
fn open_url(url: &str) -> i32a web page (http / https / mailto ...) in the default application -> 0 / -1fn open_folder(path: &str) -> i32show a folder (or a file selected in its folder) in the file manager -> 0 / -1fn theme() -> i320 light, 1 dark, -1 unknown (system setting) [plat_theme]fn home() -> Option<String>the user's home folder (%USERPROFILE%, else "C:/") [plat_home]fn drives() -> Vec<String>the drive roots ("C:/", "D:/", ...) [plat_drives]fn restart_self(args: &[&str]) -> i32like spawn_self, but the program file now at this process's path (after an update a new file): the loader keeps the path the program was started from, also when the running exe was renamed since -> 0 / -1fn spawn_self(args: &[&str]) -> i32start this executable again with the arguments (no inherited handles) -> 0 / -1