This repository was archived by the owner on Nov 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change 81
81
//!
82
82
//! ``` ignore,no_run
83
83
//! use std::env;
84
- //! use std::fs::File;
85
- //! use std::io::Write;
86
- //! use std::path::Path;
84
+ //! use std::fs;
85
+ //! use std::path::PathBuf;
87
86
//!
88
- //! /// Put the linker script somewhere the linker can find it.
89
87
//! fn main() {
90
- //! let out_dir = env::var("OUT_DIR").expect("No out dir");
91
- //! let dest_path = Path::new(&out_dir);
92
- //! let mut f = File::create(&dest_path.join("memory.x"))
93
- //! .expect("Could not create file");
94
- //!
95
- //! f.write_all(include_bytes!("memory.x"))
96
- //! .expect("Could not write file");
97
- //!
98
- //! println!("cargo:rustc-link-search={}", dest_path.display());
88
+ //! let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
99
89
//!
90
+ //! // Put the linker script somewhere the linker can find it.
91
+ //! fs::write(out_dir.join("memory.x"), include_bytes!("memory.x")).unwrap();
92
+ //! println!("cargo:rustc-link-search={}", out_dir.display());
100
93
//! println!("cargo:rerun-if-changed=memory.x");
94
+ //!
101
95
//! println!("cargo:rerun-if-changed=build.rs");
102
96
//! }
103
97
//! ```
You can’t perform that action at this time.
0 commit comments