Skip to content

Instantly share code, notes, and snippets.

@WolfgangSenff
Created August 17, 2021 14:54
Show Gist options
  • Save WolfgangSenff/461f00f9a325a8b709d3d2cd5a54d88f to your computer and use it in GitHub Desktop.
Save WolfgangSenff/461f00f9a325a8b709d3d2cd5a54d88f to your computer and use it in GitHub Desktop.
File open broken
extends Node2D
func _ready() -> void:
var file = File.new()
var file_location = "user://cache_temp/icon.png"
if not file.file_exists(file_location):
var result = file.open(file_location, File.WRITE_READ)
var buffer = preload("res://icon.png").get_data().get_data()
file.store_buffer(buffer)
file.close()
else:
var result = file.open(file_location, File.READ)
var imageArray = file.get_buffer(file.get_len())
print(imageArray)
file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment