Skip to content
Snippets Groups Projects
Commit 445b278d authored by Florent Berthaut's avatar Florent Berthaut
Browse files

Fix copying / starting on Android

parent f132836c
Branches
No related tags found
No related merge requests found
......@@ -413,7 +413,7 @@ bool GdPd::open_patch() {
std::string pdPatchStr;
std::string pdDirStr;
/*
//If opening from editor, just set the paths
if(OS::get_singleton()->has_feature("editor")) {
print("Loading patch from editor");
String fullpath = ProjectSettings::get_singleton()
......@@ -427,7 +427,8 @@ bool GdPd::open_patch() {
pdPatchStr = std::string(pat.utf8().get_data());
pdDirStr = std::string(dir.utf8().get_data());
}
else {*/
else {
// Otherwise, copy the files to user folder
print("Loading patch from package");
String userPath;
......@@ -457,14 +458,15 @@ bool GdPd::open_patch() {
std::vector<String> gdpdFiles{"gdpd.pd", "gdpd_send.pd",
"gdpd_receive.pd"};
for(auto& f : gdpdFiles) {
DirAccess::copy_absolute("res://addons/gdpd/patches/"+f,
userPath+patchDir+"/"+f);
Ref<DirAccess> diracc = DirAccess::open("res://");
diracc->copy("res://addons/gdpd/patches/"+f,
userPath+patchDir+"/"+f);
}
//Define new paths
pdPatchStr = std::string(patch.utf8().get_data());
pdDirStr = std::string((userPath+patchDir).utf8().get_data());
//}
}
// Open the patch
......@@ -477,6 +479,8 @@ bool GdPd::open_patch() {
else {
print("Opened patch "+pdPatchStr);
m_patchOpened=true;
std::string patchStr(pd_patch.utf8().get_data());
m_patchsMap[patchStr] = p1;
}
return true;
}
......@@ -490,28 +494,29 @@ void GdPd::recurseCopy(String fromPath, String toPath) {
PackedStringArray files = DirAccess::get_files_at(fromPath);
for(int i=0; i<files.size(); ++i) {
String fileName = files[i];
print("File "+std::string(fileName.utf8().get_data()));
DirAccess::copy_absolute(fromPath+"/"+fileName,
toPath+"/"+fileName);
Ref<DirAccess> diracc = DirAccess::open("res://");
diracc->copy(fromPath+"/"+fileName, toPath+"/"+fileName);
print("Copying "+ std::string(fileName.utf8().get_data()));
}
//For each dir, call recursCopy
PackedStringArray dirs = DirAccess::get_directories_at(fromPath);
for(int i=0; i<dirs.size(); ++i) {
String dirName = dirs[i];
print("Dir "+std::string(dirName.utf8().get_data()));
recurseCopy(fromPath+"/"+dirName, toPath+"/"+dirName);
}
}
void GdPd::close_patch() {
/*
std::string patchStr(patch.utf8().get_data());
//FIXME handle multiple patches
std::string patchStr(pd_patch.utf8().get_data());
if(m_patchsMap.find(patchStr)!=m_patchsMap.end()) {
m_pd.closePatch(m_patchsMap[patchStr]);
m_patchsMap.erase(patchStr);
m_patchOpened=false;
print("Closed patch "+patchStr);
}*/
}
}
void GdPd::print(const std::string& message) {
......
......@@ -141,17 +141,6 @@ public:
void send(String destination, Array arguments);
/*
bool has_message();
Array get_next();
int blocksize();
void subscribe(String symbStr);
int start_message(int nbValues);
void add_symbol(String symbStr);
void add_float(float val);
int finish_list(String destStr);
*/
virtual void print(const std::string& message);
//libpd hooks
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment