Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

Fix unsafe NSHomeDirectory Update READE.md

Aleksei Savinfe3f6ef862b7
diff --git a/crates/uzu/src/utils/storage.rs b/crates/uzu/src/utils/storage.rs
index 85a575764..c6059cea7 100644
--- a/crates/uzu/src/utils/storage.rs
+++ b/crates/uzu/src/utils/storage.rs
@@ -1,6 +1,7 @@
use std::path::PathBuf;
-use objc2_foundation::NSHomeDirectory;
+use objc2::rc::Retained;
+use objc2_foundation::{NSHomeDirectory, NSString};
/// `NSSearchPathDirectory` values (Darwin) so they can be passed directly to
/// `NSFileManager::URLsForDirectory:inDomains:` via an `as u64` cast.
@@ -101,7 +102,11 @@ pub fn storage_path() -> PathBuf {
// `~/Library/Containers/<bundle-id>/Data`. Persist model files inside
// the app-scoped caches directory to comply with sandbox rules:
// `~/Library/Containers/<bundle-id>/Data/Library/Caches/…`.
- let home = NSHomeDirectory().to_string();
+ let home: String = unsafe {
+ let ns_str: Retained<NSString> = NSHomeDirectory();
+ ns_str.to_string()
+ };
+
PathBuf::from(&home).join("Library").join("Caches")
};