mirror of
https://github.com/widberg/bff
synced 2026-08-23 14:26:03 -04:00
[CLI] Enable long path aware on Windows
This commit is contained in:
parent
17afe3194b
commit
3aa9ceee74
2 changed files with 56 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
use std::env;
|
||||
|
||||
use shadow_rs::{BuildPattern, ShadowBuilder};
|
||||
|
||||
fn main() {
|
||||
|
|
@ -5,4 +7,30 @@ fn main() {
|
|||
.build_pattern(BuildPattern::Lazy)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
set_windows_exe_options();
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust/commit/5e6bb83268518dcd74c96b5504f485b71e604e4c
|
||||
// https://github.com/BurntSushi/ripgrep/commit/db6bb21a629d5b1ec1bfe89c693b280497c9eedc
|
||||
// Add a manifest file to bff-cli.exe.
|
||||
fn set_windows_exe_options() {
|
||||
static MANIFEST: &str = "pkg/windows/Manifest.xml";
|
||||
|
||||
let Ok(target_os) = env::var("CARGO_CFG_TARGET_OS") else { return };
|
||||
let Ok(target_env) = env::var("CARGO_CFG_TARGET_ENV") else { return };
|
||||
if !(target_os == "windows" && target_env == "msvc") {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut manifest = env::current_dir().unwrap();
|
||||
manifest.push(MANIFEST);
|
||||
let manifest = manifest.to_str().unwrap();
|
||||
|
||||
println!("cargo:rerun-if-changed={}", MANIFEST);
|
||||
// Embed the Windows application manifest file.
|
||||
println!("cargo:rustc-link-arg-bin=bff-cli=/MANIFEST:EMBED");
|
||||
println!("cargo:rustc-link-arg-bin=bff-cli=/MANIFESTINPUT:{manifest}");
|
||||
// Turn linker warnings into errors.
|
||||
println!("cargo:rustc-link-arg-bin=bff-cli=/WX");
|
||||
}
|
||||
|
|
|
|||
28
bff-cli/pkg/windows/Manifest.xml
Normal file
28
bff-cli/pkg/windows/Manifest.xml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
This is a Windows application manifest file.
|
||||
See: https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests
|
||||
-->
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- Versions rustc supports as compiler hosts -->
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 7 --><supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 --><supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 --><supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 and 11 --><supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Use UTF-8 code page -->
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
|
||||
<activeCodePage>UTF-8</activeCodePage>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
<!-- Remove (most) legacy path limits -->
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
|
||||
<ws2:longPathAware>true</ws2:longPathAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
Loading…
Add table
Add a link
Reference in a new issue