Don't try to load the shader code if the file couldn't be opened
This commit is contained in:
parent
4d12ad4432
commit
7b72274140
1 changed files with 6 additions and 5 deletions
|
@ -61,11 +61,12 @@ 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)
|
||||||
self.shader_code = file.get_as_text()
|
if file != null:
|
||||||
if "/" in path: # update current working directory
|
self.shader_code = file.get_as_text()
|
||||||
self.cwd = path.substr(0, path.rfind("/"))
|
if "/" in path: # update current working directory
|
||||||
self.last_shader_savepath = path
|
self.cwd = path.substr(0, path.rfind("/"))
|
||||||
store_last_opened_file()
|
self.last_shader_savepath = path
|
||||||
|
store_last_opened_file()
|
||||||
|
|
||||||
func save_shader(path: String):
|
func save_shader(path: String):
|
||||||
print("Save ", path)
|
print("Save ", path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue