MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / ReadFile

Method ReadFile

StereoKit/Util/Platform.cs:183–190  ·  view source on GitHub ↗

Reads the entire contents of the file as a UTF-8 string, taking advantage of any permissions that may have been granted by Platform.FilePicker. Path to the file. Not affected by Assets folder path. A UTF-8 decoded string representing the contents of the file. Will be null on failure. True on success, False on fai

(string filename, out string data)

Source from the content-addressed store, hash-verified

181 /// contents of the file. Will be null on failure.</param>
182 /// <returns>True on success, False on failure.</returns>
183 public static bool ReadFile (string filename, out string data) {
184 data = null;
185 if (!NativeAPI.platform_read_file(NativeHelper.ToUtf8(filename), out IntPtr fileData, out UIntPtr length))
186 return false;
187
188 data = NativeHelper.FromUtf8(fileData, (int)length);
189 return true;
190 }
191
192 /// <summary>Reads the entire contents of the file as a UTF-8 string,
193 /// taking advantage of any permissions that may have been granted by

Callers 1

StepMethod · 0.80

Calls 4

platform_read_fileMethod · 0.80
ToUtf8Method · 0.80
FromUtf8Method · 0.80
CopyMethod · 0.45

Tested by

no test coverage detected