Skip to content

Commit

Permalink
Fix: creating a new behavior fails when onboard engine is running (see
Browse files Browse the repository at this point in the history
  • Loading branch information
pschillinger committed Apr 6, 2017
1 parent 68d8257 commit 18db680
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/io/io_behaviorsaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ IO.BehaviorSaver = new (function() {
var file_path = path.join(folder_path, names.file_name);
var file_tmp_path = path.join(folder_path, names.file_name_tmp);
if (RC.Controller.isConnected()) {
IO.Filesystem.checkFileExists(folder_path, names.file_name_tmp, function(exists) {
if (!exists) {
IO.Filesystem.getFileContent(folder_path, names.file_name, function(content_onboard) {
IO.Filesystem.createFile(folder_path, names.file_name_tmp, content_onboard, function() {
IO.Filesystem.checkFileExists(folder_path, names.file_name_tmp, function(tmp_exists) {
if (!tmp_exists) {
IO.Filesystem.checkFileExists(folder_path, names.file_name_tmp, function(src_exists) {
if (src_exists) {
IO.Filesystem.getFileContent(folder_path, names.file_name, function(content_onboard) {
IO.Filesystem.createFile(folder_path, names.file_name_tmp, content_onboard, function() {
create_callback(folder_path);
});
});
} else {
create_callback(folder_path);
});
}
});
} else {
create_callback(folder_path);
Expand Down

0 comments on commit 18db680

Please sign in to comment.