Don't try to load the shader code if the file couldn't be opened

This commit is contained in:
ChaoticByte 2025-01-08 19:41:29 +01:00
parent 4d12ad4432
commit 7b72274140
No known key found for this signature in database

View file

@ -61,6 +61,7 @@ func save_result(path: String):
func load_shader(path: String): func load_shader(path: String):
print("Load ", path) print("Load ", path)
var file = FileAccess.open(path, FileAccess.READ) var file = FileAccess.open(path, FileAccess.READ)
if file != null:
self.shader_code = file.get_as_text() self.shader_code = file.get_as_text()
if "/" in path: # update current working directory if "/" in path: # update current working directory
self.cwd = path.substr(0, path.rfind("/")) self.cwd = path.substr(0, path.rfind("/"))