+1 vote

Hi, I am trying to create a plugin to import/create tileset from sprite image. I want to make sure that the chosen sprite file resides in the res:// folder. If it is not, then I want to copy the sprite file to res:// folder. I checked the GDScript help file, but I couldn't find any method for this. Can anyone share how you will copy a file from one location to another in GDScript?

Thanks in advance.

in Engine by (25 points)

1 Answer

+1 vote

already try:

Error copy( String from, String to) ?

type copy in the search help in the script tab to see.

by (425 points)

Example use:

var dir = Directory.new()
dir.copy("res://files/sprite_image.tex", "res://sprite_image.tex")
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 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 webmaster@godotengine.org with your username.