This commit is contained in:
life
2015-03-13 00:20:58 +08:00
parent 5527cd6d47
commit 7f11dd63ee
13 changed files with 58 additions and 24 deletions

13
node_modules/common.js generated vendored
View File

@@ -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];