28 lines
836 B
GDScript
28 lines
836 B
GDScript
extends Control
|
|
|
|
var directory = "res://"
|
|
var file_name = "Text"
|
|
|
|
func _ready():
|
|
get_node("Pathway").set_text("Pathway: " + directory)
|
|
|
|
func _on_text_edit_text_changed():
|
|
# Get the files and variable stuff
|
|
var file_extension = get_node("Extensions").get_item_text(get_node("Extensions").selected)
|
|
var file = FileAccess.open(directory + "/" + file_name + file_extension, FileAccess.WRITE)
|
|
|
|
# Store the text. Because of how it works, we can just store a large string
|
|
file.store_string(get_node("TextEdit").get("text"))
|
|
file = null
|
|
|
|
# Getting a pathway (bottom 2 functions)
|
|
func _on_pathway_pressed():
|
|
get_node("Pathway_File").popup()
|
|
|
|
func _on_pathway_file_dir_selected(dir):
|
|
directory = dir
|
|
get_node("Pathway").set_text("Pathway: " + directory)
|
|
|
|
# Changing the name
|
|
func _on_name_text_changed(new_text):
|
|
file_name = new_text
|