Skip to content

Commit 2bbf33f

Browse files
authored
Merge pull request #7 from rcodyp/main
fixed merger error
2 parents 9d70de9 + 5a5eec5 commit 2bbf33f

2 files changed

Lines changed: 53 additions & 2 deletions

File tree

compiler/mesh-codegen/src/link.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ pub(crate) fn link_with_plan(
200200
/// profiles. Prefers the profile matching the compiler's own build: a release
201201
/// `meshc` links the release runtime, a debug `meshc` links the debug runtime.
202202
fn find_mesh_rt(target: &LinkTarget) -> Result<PathBuf, String> {
203+
// ENV override (highest priority)
204+
if let Ok(path) = std::env::var("MESH_RT_PATH") {
205+
let path = PathBuf::from(path);
206+
if path.exists() {
207+
return Ok(path);
208+
}
209+
}
210+
203211
let profiles: &[&str] = if cfg!(debug_assertions) {
204212
&["debug", "release"]
205213
} else {
@@ -217,6 +225,49 @@ fn find_mesh_rt(target: &LinkTarget) -> Result<PathBuf, String> {
217225
}
218226
}
219227

228+
// NEW: fallback directories
229+
let mut extra_dirs: Vec<PathBuf> = Vec::new();
230+
231+
// ~/.mesh/lib
232+
if let Some(home) = std::env::var_os("HOME") {
233+
extra_dirs.push(PathBuf::from(home).join(".mesh/lib"));
234+
}
235+
236+
// current working directory
237+
if let Ok(current) = std::env::current_dir() {
238+
extra_dirs.push(current);
239+
}
240+
241+
// directory of meshc binary
242+
if let Ok(exe) = std::env::current_exe() {
243+
if let Some(parent) = exe.parent() {
244+
extra_dirs.push(parent.to_path_buf());
245+
}
246+
}
247+
248+
// search fallback dirs
249+
for dir in extra_dirs {
250+
// check profile-based structure
251+
for profile in profiles {
252+
let candidate = dir.join(profile).join(target.runtime_filename());
253+
254+
if candidate.exists() {
255+
return Ok(candidate);
256+
}
257+
258+
searched_paths.push(candidate);
259+
}
260+
261+
// check direct file
262+
let direct = dir.join(target.runtime_filename());
263+
if direct.exists() {
264+
return Ok(direct);
265+
}
266+
267+
searched_paths.push(direct);
268+
}
269+
270+
// error message (unchanged)
220271
let mut message = format!(
221272
"Could not locate Mesh runtime static library for target '{}'. Expected {}. Run `cargo build -p mesh-rt{}` first.",
222273
target.display_triple(),

website/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "vitepress dev docs",
88
"build": "vitepress build docs",
99
"preview": "vitepress preview docs",
10-
"generate:og": "python3 scripts/generate-og-image.py"
10+
"generate:og": "python3 scripts/generate-og-image.py || (echo Python is not installed. Please install it from https://www.python.org/downloads/ and try again. && exit 1)"
1111
},
1212
"keywords": [],
1313
"author": "",
@@ -31,4 +31,4 @@
3131
"@types/node": "^25.2.3",
3232
"typescript": "^5.9.3"
3333
}
34-
}
34+
}

0 commit comments

Comments
 (0)