So this isn’t a game perse. I’m making a music editor in godot that outputs SNES playable files.
right now, I’m just getting the basics of my project implemented by adding the ability for the user to import “.brr” samples into the project. (yes, I know it’s an unsupported file type, I’m working on making a GDextension for it)
Currently, I’ve implemented dragging and dropping files into the editor, and my script can recognize whether or not it’s a “.brr” sample or not. What I’m trying to do now is to get the program to copy the file, and paste it into a user specified path.
As you can see, it can import files and recognize “.brr” samples. How would I go about copying and pasting the sample into a user specified folder? (keep in mind for the time being that godot does not know what a .brr sample is)
To copy a task all you can do is copy its content and save the content to a new file, this example might work just fine, but I don’t know what encryption and format .brr is stored with:
var source_path = "res://path/to/source/file.txt"
var destination_path = "res://path/to/destination/file.txt"
...
var file = File.new()
if file.file_exists(source_path):
file.open(source_path, File.READ)
var content = file.get_as_text()
file.close()
else:
print("Source file does not exist")
file.open(destination_path, File.WRITE)
file.store_string(content)
file.close()
print("File copied successfully")
...
You may need to use other methods instead of get_as_text and store_string or manually adjust encoders like UTF-8