- Edited
I am trying to make an android app that lets the user select an image from gallery and saving it in a data folder for later use. The image is classified by topic and subtopic, the data folder also having a folder system organized as such:
The problem is, on Android, I can't create directories and folders in "res://", I belive that's because the .apk is self contained, but i'm not 100% sure. My solution is moving the data from res:// to user:// for easy acces to it.
I am using this recursive function to move all files and folders from a root folder to it's counterpart in "user://":
func move_all_topic_data_to_user(var path):
var err
var dir=Directory.new()
var user_dir=Directory.new()
var copy_dir=Directory.new()
dir.open("res://Data" + path)
user_dir.open("user://"+path)
dir.list_dir_begin(true)
var file="(-_-)"
while file!="":
file=dir.get_next()
if file!="" and !file.begins_with("."):
if dir.dir_exists(file):
err=user_dir.make_dir(file)
#print(err,file)
move_all_topic_data_to_user(path+"/"+file)
if dir.file_exists(file):
if !user_dir.file_exists(file):
err=copy_dir.copy("res://Data"+path+"/"+file,"user://"+path+"/"+file)
#print(err,path+"/"+file)
dir.list_dir_end()
This works perfectly on PC, but when i try to run it on Android, the app just crashes with the error message:
Condition "!process_map->has(p_pid)" is true
From my tests, the crash doesn't happen from a simple call of dir.open(), dir.copy() and user_dir.make_dir(). What could be the problem?