Files
desktop-app/node_modules/evt.js
2015-02-21 23:08:16 +08:00

39 lines
885 B
JavaScript

var fs = require('fs');
var User = require('user');
function log(o) {
console.log(o);
};
// 为什么不存在?
// var dataBasePath = require('nw.gui').App.dataPath; // + '/data';
/*
// 判断是否存在, 不存在则创建dir
if(!fs.existsSync(dataBasePath)) {
fs.mkdirSync(dataBasePath);
}
*/
dataBasePath = '';
var Evt = {
leanoteUrl: 'http://localhost:9000',
port: 8008,
localUrl: 'http://127.0.0.1:8008',
getImageLocalUrl: function(fileId) {
return this.localUrl + '/api/file/getImage?fileId=' + fileId;
},
getAttachLocalUrl: function(fileId) {
return this.localUrl + '/api/file/getAttach?fileId=' + fileId;
},
// 项目绝对地址
getBasePath: function() {
// return dataBasePath; // process.cwd();
return process.cwd();
},
getAbsolutePath: function(relative) {
var me = this;
return me.getBasePath() + '/' + relative;
}
};
module.exports = Evt;