Skip to content

pattlebass/Godot-File-Picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Godot-File-Picker

An Android plugin for Godot 3.5+ that allow you to open the native file dialog and choose a file. This file will be copied to user://_temp/original_file_name. After you are finished, you have to delete the temporary file yourself.

API Reference

Functions

Note Argument cannot be null. See a list of common MIME types.

openFilePicker(mimeType: String) -> void

Signals

file_picked(String temp_path, String mime_type)

Usage

var android_picker


func _ready() -> void:
    if Engine.has_singleton("GodotFilePicker"):
        android_picker = Engine.get_singleton("GodotFilePicker")
        android_picker.connect("file_picked", self, "_on_file_picked")


func _on_Button_pressed() -> void:
    # Call the file picker (with the specified type)
    android_picker.openFilePicker("*/*")


func _on_file_picked(temp_path: String, mime_type: String) -> void:
    print("Temporary path: " + temp_path)
    print("Mime type: " + mime_type)

    # Here you read the file or copy it to another directory

    # Now you can delete the temporary file
    var dir = Directory.new()
    dir.remove(temp_path)

About

Allows you to open the native Android file picker

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages