From f0526d17de6cf757a1a96875c9daaa56592f68eb Mon Sep 17 00:00:00 2001 From: James Onnen Date: Mon, 23 Aug 2021 12:21:01 -0700 Subject: [PATCH] Support long file paths on Windows (past 256 limit) (#464) * Support long file paths on Windows (past 256 limit) This issue can occur when using symlinks deep in rojo such that very long paths can occur, among other scenarios. Note while the original fix comes from here: https://gal.hagever.com/posts/windows-long-paths-in-rust/ The manifest had to be modified from this source: https://stackoverflow.com/questions/59816045/windows-10-1903-longpathaware-not-working * Move manifests, tidy code a little Co-authored-by: Lucien Greathouse --- Cargo.lock | 34 ++++++++++++++++++++++++++++++++++ Cargo.toml | 2 ++ build.rs | 4 ++++ build/windows/rojo-manifest.rc | 2 ++ build/windows/rojo.manifest | 8 ++++++++ 5 files changed, 50 insertions(+) create mode 100644 build/windows/rojo-manifest.rc create mode 100644 build/windows/rojo.manifest diff --git a/Cargo.lock b/Cargo.lock index 5ed75c8a..19036d5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "addr2line" version = "0.16.0" @@ -552,6 +554,17 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "embed-resource" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de30eb317b4cd3882ee16623cb3004e5fb99a8f4cd40097cadf61efbc54adc" +dependencies = [ + "cc", + "vswhom", + "winreg 0.9.0", +] + [[package]] name = "encode_unicode" version = "0.3.6" @@ -2228,6 +2241,7 @@ dependencies = [ "criterion", "crossbeam-channel", "csv", + "embed-resource", "env_logger", "fs-err", "futures 0.3.16", @@ -2968,6 +2982,26 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f5402d3d0e79a069714f7b48e3ecc60be7775a2c049cb839457457a239532" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "walkdir" version = "2.3.2" diff --git a/Cargo.toml b/Cargo.toml index 2efbe847..56db2f75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ documentation = "https://rojo.space/docs" repository = "https://github.com/rojo-rbx/rojo" readme = "README.md" edition = "2018" +build = "build.rs" exclude = [ "/test-projects/**", @@ -96,6 +97,7 @@ winreg = "0.9.0" [build-dependencies] memofs = { version = "0.1.3", path = "memofs" } +embed-resource = "1.6" anyhow = "1.0.27" bincode = "1.2.1" fs-err = "2.3.0" diff --git a/build.rs b/build.rs index fe2a840a..5ac7672b 100644 --- a/build.rs +++ b/build.rs @@ -73,5 +73,9 @@ fn main() -> Result<(), anyhow::Error> { bincode::serialize_into(out_file, &snapshot)?; + println!("cargo:rerun-if-changed=build/windows/rojo-manifest.rc"); + println!("cargo:rerun-if-changed=build/windows/rojo.manifest"); + embed_resource::compile("build/windows/rojo-manifest.rc"); + Ok(()) } diff --git a/build/windows/rojo-manifest.rc b/build/windows/rojo-manifest.rc new file mode 100644 index 00000000..2e362020 --- /dev/null +++ b/build/windows/rojo-manifest.rc @@ -0,0 +1,2 @@ +#define RT_MANIFEST 24 +1 RT_MANIFEST "rojo.manifest" \ No newline at end of file diff --git a/build/windows/rojo.manifest b/build/windows/rojo.manifest new file mode 100644 index 00000000..62ed2721 --- /dev/null +++ b/build/windows/rojo.manifest @@ -0,0 +1,8 @@ + + + + + true + + + \ No newline at end of file