Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | JensRenders |
Hi,
I want to include an executable (stockfish) with my app, such that I can run it using OS.execute(). This works if I run the app from the editor. The problem is, I don’t understand how I can access this file once the app is exported, as res:// is not guaranteed to exist. I tried copying it to user://:
DirAccess.copy_absolute("res://stockfish/stockfish_" + OS.get_name(), "user://stockfish/stockfish", 1777)
but this copy fails:
ERROR: Failed to open stockfish/stockfish_Linux
at: copy (core/io/dir_access.cpp:346)
It probably fails for the same reason: res:// does not exist? It does copy succesfully when I run it from the editor, and then I can indeed use it from user://. For the Android export I can look in the .apk and I see that stockfish/stockfish_Android is included, yet I get the same error. So if res:// is not accessible from the code, how do I get a file into user://? Or is there some other way to access a file?
Thanks a lot!