feat: Add a Windows application manifest (#3590)

* feat: Add a Windows application manifest

Closes #3589

* Enable longPathAware

* Switch to winres crate

* Only depend on winres on Windows

* Switch to cfg attribute
This commit is contained in:
Segev Finer 2022-02-20 19:12:40 +02:00 committed by GitHub
parent e09b821c42
commit a98908f05e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 2 deletions

10
Cargo.lock generated
View File

@ -1649,6 +1649,7 @@ dependencies = [
"versions", "versions",
"which", "which",
"winapi", "winapi",
"winres",
"yaml-rust", "yaml-rust",
] ]
@ -2106,6 +2107,15 @@ version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08cabc9f0066848fef4bc6a1c1668e6efce38b661d2aeec75d18d8617eebb5f1" checksum = "08cabc9f0066848fef4bc6a1c1668e6efce38b661d2aeec75d18d8617eebb5f1"
[[package]]
name = "winres"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
dependencies = [
"toml",
]
[[package]] [[package]]
name = "winrt-notification" name = "winrt-notification"
version = "0.5.0" version = "0.5.0"

View File

@ -84,6 +84,9 @@ nix = "0.23.1"
[build-dependencies] [build-dependencies]
shadow-rs = "0.8.1" shadow-rs = "0.8.1"
[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"
[dev-dependencies] [dev-dependencies]
mockall = "0.11" mockall = "0.11"
tempfile = "3.2.0" tempfile = "3.2.0"

View File

@ -1,3 +1,14 @@
fn main() -> shadow_rs::SdResult<()> { use std::error::Error;
shadow_rs::new()
fn main() -> Result<(), Box<dyn Error>> {
shadow_rs::new().map_err(|err| err.to_string())?;
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
res.set_manifest_file("starship.exe.manifest");
res.compile()?;
}
Ok(())
} }

32
starship.exe.manifest Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 & 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>