mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 23:55:50 +00:00
win
This commit is contained in:
13
node_modules/common.js
generated
vendored
13
node_modules/common.js
generated
vendored
@@ -30,6 +30,13 @@ var Common = {
|
||||
this._uuid++;
|
||||
return ((new Date()).getTime()) + '_' + this._uuid;
|
||||
},
|
||||
// 得到目录分隔符
|
||||
getPathSep: function() {
|
||||
if(process.platform.indexOf('win') != -1) {
|
||||
return "\"";
|
||||
}
|
||||
return '/';
|
||||
},
|
||||
isOk: function(ret) {
|
||||
if(!ret) {
|
||||
return ret;
|
||||
@@ -109,14 +116,16 @@ var Common = {
|
||||
if(!fullFilePath) {
|
||||
return ret;
|
||||
}
|
||||
var strs = fullFilePath.split('/');
|
||||
var strs = fullFilePath.split(this.getPathSep());
|
||||
if(strs.length == 1) {
|
||||
ret.name = strs;
|
||||
ret.name = strs[0];
|
||||
} else {
|
||||
ret.name = strs[strs.length - 1];
|
||||
strs.pop();
|
||||
ret.path = strs.join('/');
|
||||
}
|
||||
// console.log("---");
|
||||
// console.log(ret);
|
||||
var names = ret.name.split('.');
|
||||
if(names.length > 1) {
|
||||
ret.ext = names[names.length - 1];
|
||||
|
Reference in New Issue
Block a user