Initial ForgeLM import

This commit is contained in:
Evandro Fonseca Junior committed 2026-03-29 19:10:57 -03:00
commit a392b9dc60
4296 files changed
+1212675

No files matched your search

@@ -0,0 +1,37 @@
use std::path::{Path, PathBuf};
const MODEL_LIBRARY_DIR: &str = "model-library";
const INDEX_FILE: &str = "index.json";
const MANAGED_MODELS_DIR: &str = "managed-models";
pub fn model_library_dir(app_data_dir: &Path) -> PathBuf {
app_data_dir.join(MODEL_LIBRARY_DIR)
}
pub fn model_library_index_path(app_data_dir: &Path) -> PathBuf {
model_library_dir(app_data_dir).join(INDEX_FILE)
}
pub fn managed_models_dir(app_data_dir: &Path) -> PathBuf {
model_library_dir(app_data_dir).join(MANAGED_MODELS_DIR)
}
#[cfg(test)]
mod tests {
use super::{managed_models_dir, model_library_dir, model_library_index_path};
#[test]
fn model_library_paths_live_under_app_data_dir() {
let root = std::path::Path::new("C:/Users/demo/AppData/Roaming/ForgeLM");
assert_eq!(model_library_dir(root), root.join("model-library"));
assert_eq!(
model_library_index_path(root),
root.join("model-library").join("index.json")
);
assert_eq!(
managed_models_dir(root),
root.join("model-library").join("managed-models")
);
}
}