File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -332,13 +332,30 @@ impl GFile {
332
332
///
333
333
/// Underlying Godot method:
334
334
/// [`FileAccess::get_as_text`](https://docs.godotengine.org/en/stable/classes/class_fileaccess.html#class-fileaccess-method-get-as-text).
335
+ // For Godot versions before `skip_cr` has been removed, see: https://github.com/godotengine/godot/pull/110867.
335
336
#[ doc( alias = "get_as_text" ) ]
337
+ #[ cfg( before_api = "4.6" ) ]
336
338
pub fn read_as_gstring_entire ( & mut self , skip_cr : bool ) -> std:: io:: Result < GString > {
337
339
let val = self . fa . get_as_text_ex ( ) . skip_cr ( skip_cr) . done ( ) ;
338
340
self . check_error ( ) ?;
339
341
Ok ( val)
340
342
}
341
343
344
+ /// Reads the whole file as UTF-8 [`GString`].
345
+ ///
346
+ /// To retrieve the file as [`String`] instead, use the [`Read`] trait method
347
+ /// [`read_to_string()`](https://doc.rust-lang.org/std/io/trait.Read.html#method.read_to_string).
348
+ ///
349
+ /// Underlying Godot method:
350
+ /// [`FileAccess::get_as_text`](https://docs.godotengine.org/en/stable/classes/class_fileaccess.html#class-fileaccess-method-get-as-text).
351
+ #[ doc( alias = "get_as_text" ) ]
352
+ #[ cfg( since_api = "4.6" ) ]
353
+ pub fn read_as_gstring_entire ( & mut self ) -> std:: io:: Result < GString > {
354
+ let val = self . fa . get_as_text ( ) ;
355
+ self . check_error ( ) ?;
356
+ Ok ( val)
357
+ }
358
+
342
359
/// Reads the next line of the file in delimiter-separated file.
343
360
///
344
361
/// For reading traditional `CSV` format, provide comma (`','`) as `delim`.
You can’t perform that action at this time.
0 commit comments