MCPcopy Create free account
hub / github.com/PerroEngine/Perro / format_command

Function format_command

perro_source/devtools/perro_cli/src/project.rs:438–483  ·  view source on GitHub ↗
(args: &[String], cwd: &Path)

Source from the content-addressed store, hash-verified

436#[cfg(target_os = "linux")]
437fn scripts_dylib_name() -> &'static str {
438 "libscripts.so"
439}
440
441#[cfg(target_os = "macos")]
442fn scripts_dylib_name() -> &'static str {
443 "libscripts.dylib"
444}
445
446pub(crate) fn copy_steam_runtime_library(
447 target_dir: &Path,
448 profile_dir: &str,
449 output_dir: &Path,
450) -> Result<(), String> {
451 let Some(library_name) = steam_runtime_library_name() else {
452 return Ok(());
453 };
454 let build_dir = target_dir.join(profile_dir).join("build");
455 let source = find_steam_runtime_library(&build_dir, library_name).ok_or_else(|| {
456 format!(
457 "Steam enabled but {library_name} was not found under {}",
458 build_dir.display()
459 )
460 })?;
461 fs::create_dir_all(output_dir)
462 .map_err(|err| format!("failed to create {}: {err}", output_dir.display()))?;
463 let target = output_dir.join(library_name);
464 fs::copy(&source, &target).map_err(|err| {
465 format!(
466 "failed to copy Steam runtime library from {} to {}: {err}",
467 source.display(),
468 target.display()
469 )
470 })?;
471 Ok(())
472}
473
474fn steam_runtime_library_name() -> Option<&'static str> {
475 if cfg!(target_os = "windows") {
476 Some("steam_api64.dll")
477 } else if cfg!(target_os = "linux") {
478 Some("libsteam_api.so")
479 } else if cfg!(target_os = "macos") {
480 Some("libsteam_api.dylib")
481 } else {
482 None
483 }
484}
485
486fn find_steam_runtime_library(build_dir: &Path, library_name: &str) -> Option<PathBuf> {

Callers 1

mainFunction · 0.85

Calls 12

resolve_project_res_rootFunction · 0.85
log_noteFunction · 0.85
log_stepFunction · 0.85
log_doneFunction · 0.85
format_asset_fileFunction · 0.85
anyMethod · 0.80
parse_flag_valueFunction · 0.70
resolve_local_pathFunction · 0.70
iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected