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)
| 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 |
no test coverage detected