Skip to content

Commit 0a8982d

Browse files
committed
Specify file open permissions needed as read only. (Causing access failed in environments with strict read-only file system settings)
1 parent 26a7114 commit 0a8982d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

LLama/Native/SafeLlamaModelHandle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static SafeLlamaModelHandle LoadFromFile(string modelPath, LLamaModelPara
129129
// - File exists (automatically throws FileNotFoundException)
130130
// - File is readable (explicit check)
131131
// This provides better error messages that llama.cpp, which would throw an access violation exception in both cases.
132-
using (var fs = new FileStream(modelPath, FileMode.Open))
132+
using (var fs = new FileStream(modelPath, FileMode.Open, FileAccess.Read))
133133
if (!fs.CanRead)
134134
throw new InvalidOperationException($"Model file '{modelPath}' is not readable");
135135

0 commit comments

Comments
 (0)