From dd12dccedea5ede32a01a9416bb2076a66ffee4c Mon Sep 17 00:00:00 2001 From: life Date: Fri, 1 Jan 2016 21:04:09 +0800 Subject: [PATCH] export fix path for windows --- node_modules/common.js | 7 ++++--- public/plugins/export_html/plugin.js | 2 +- public/plugins/export_pdf/plugin.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/node_modules/common.js b/node_modules/common.js index 162b6962..6be9f823 100644 --- a/node_modules/common.js +++ b/node_modules/common.js @@ -142,6 +142,7 @@ var Common = { }, // 拆分filePath的各个部分 splitFile: function(fullFilePath) { + var pme = this; var ret = { path: "", // a/b name: "", // c.js @@ -151,9 +152,9 @@ var Common = { var me = this; if(me.path) { if(me.ext) { - return me.path + '/' + me.nameNotExt + '.' + me.ext; + return me.path + pme.getPathSep() + me.nameNotExt + '.' + me.ext; } else { - return me.path + '/' + me.nameNotExt; + return me.path + pme.getPathSep() + me.nameNotExt; } } else { if(me.ext) { @@ -173,7 +174,7 @@ var Common = { } else { ret.name = strs[strs.length - 1]; strs.pop(); - ret.path = strs.join('/'); + ret.path = strs.join(pme.getPathSep()); } // console.log("---"); // console.log(ret); diff --git a/public/plugins/export_html/plugin.js b/public/plugins/export_html/plugin.js index d0fd4842..a7c9b9d2 100644 --- a/public/plugins/export_html/plugin.js +++ b/public/plugins/export_html/plugin.js @@ -312,7 +312,7 @@ define(function() { var name = note.Title ? note.Title + '.html' : getMsg('Untitled') + '.html'; name = me.fixFilename(name); - var targetPath = path + '/' + name; + var targetPath = path + Api.commonService.getPathSep() + name; // 将路径和名字区分开 var pathInfo = Api.commonService.splitFile(targetPath); diff --git a/public/plugins/export_pdf/plugin.js b/public/plugins/export_pdf/plugin.js index a6b194bd..403eb60f 100644 --- a/public/plugins/export_pdf/plugin.js +++ b/public/plugins/export_pdf/plugin.js @@ -287,7 +287,7 @@ define(function() { var name = note.Title ? note.Title + '.pdf' : getMsg('Untitled') + '.pdf'; name = me.fixFilename(name); - var targetPath = path + '/' + name; + var targetPath = path + Api.commonService.getPathSep() + name; // 将路径和名字区分开 var pathInfo = Api.commonService.splitFile(targetPath);