0 votes

I'm having trouble loading a file path into my save system, _file_selected( String path )

What I am doing is saving the path to the file in a var called filepath.
I then use this path in the savegame function to open a file

(AKA File.new().open(filepath,File.WRITE))

However I am having trouble getting the filepath when loading/opening the file. Save mode works, but not MODEOPENFILE

extends Control

var num = 0
var filepath
var file #The name of the FileDialog, Confusing I know.

func _ready():
    file = get_node("file")
#File node
func display_file(filetype):

func _on_file_file_selected( path ):
    filepath = path 
    if file.MODE_SAVE_FILE:
        print("Filename: "+str(file.get_current_file()))

    elif file.MODE_OPEN_FILE:
        print("Filename: "+str(file.get_current_file()))
        print("Error, Could not load/Save")

#Click button
func _on_click_pressed():
    num += 1

#Save and Load buttons
func _on_save_pressed():

func _on_load_pressed():

I am using the current stable branch 2.1.3

in Engine by (270 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.