fix compatibilies with electron9 for plugins

This commit is contained in:
chaos
2020-06-28 11:00:33 +08:00
parent 31621d41c9
commit f5903b55bb
9 changed files with 362 additions and 240 deletions

View File

@@ -405,7 +405,7 @@ define(function() {
getTargetPath: function(callback) {
// showSaveDialog 不支持property选择文件夹
Api.gui.dialog.showOpenDialog(Api.gui.getCurrentWindow(),
var po = Api.gui.dialog.showOpenDialog(Api.gui.getCurrentWindow(),
{
defaultPath: Api.gui.app.getPath('userDesktop') + '/',
properties: ['openDirectory']
@@ -414,6 +414,21 @@ define(function() {
callback(targetPath);
}
);
if(typeof(po) != "object"){
return;
}
po.then(function(re){
if(re.canceled !== false || re.filePaths.length < 1){
return;
}
callback(re.filePaths[0]);
},
function(err){
alert(err);
}
);
},
loadingIsClosed: false,