diff --git a/app/src/native_controll.js b/app/src/native_controll.js index 6db14fbb5..e40b08e4b 100644 --- a/app/src/native_controll.js +++ b/app/src/native_controll.js @@ -473,6 +473,11 @@ Entry.plugin = (function () { list.props.mode = '0777'; // console.log('entry'); }); + fs_writer.on('error', function (e) { + if($.isFunction(cb)){ + cb(e); + } + }); fs_writer.on('end', function () { if($.isFunction(cb)){ @@ -512,7 +517,9 @@ Entry.plugin = (function () { list.props.mode = '0777'; }); fs_writer.on('error', function (e) { - console.log('error'); + if($.isFunction(cb)) { + cb(data); + } }); fs_writer.on('end', function () { fs.readFile(path.resolve(_real_path, 'temp', 'project.json'), enc || 'utf8', function (err, data) { @@ -521,7 +528,7 @@ Entry.plugin = (function () { } if($.isFunction(cb)) { - cb(data); + cb(null, data); } }); }); diff --git a/app/src/workspace.js b/app/src/workspace.js index 2cab4ff25..7454af639 100644 --- a/app/src/workspace.js +++ b/app/src/workspace.js @@ -360,7 +360,17 @@ angular.module('workspace').controller("WorkspaceController", storage.setItem('defaultPath', parser.dir); try{ - myProject.saveProject(filePath, function (project_name) { + myProject.saveProject(filePath, function (e, project_name) { + if(e) { + $scope.doPopupControl({ + 'type':'hide' + }); + $scope.doPopupControl({ + 'type':'fail', + 'msg': Lang.Workspace.saving_fail_msg + }); + $scope.isNowSaving = false; + } Entry.stateManager.addStamp(); myProject.isSaved = true; myProject.isSavedPath = filePath; @@ -456,7 +466,16 @@ angular.module('workspace').controller("WorkspaceController", 'type':'spinner', 'msg': Lang.Workspace.loading_msg }); - Entry.plugin.loadProject(filePath, function (data) { + Entry.plugin.loadProject(filePath, function (e, data) { + if(e) { + $scope.doPopupControl({ + 'type':'hide' + }); + $scope.doPopupControl({ + 'type':'fail', + 'msg': Lang.Workspace.saving_fail_msg + }); + } var jsonObj = JSON.parse(data); jsonObj.path = filePath; @@ -862,9 +881,9 @@ angular.module('workspace').controller("WorkspaceController", var project = Entry.exportProject(); project.name = project_name; - Entry.plugin.saveProject(path, project, function () { + Entry.plugin.saveProject(path, project, function (e) { if($.isFunction(cb)) { - cb(project_name); + cb(e, project_name); }; }); };