This commit is contained in:
life
2015-03-21 23:00:52 +08:00
parent 80fe585d9d
commit faaa5230eb
2607 changed files with 319 additions and 345753 deletions

27
node_modules/db.js generated vendored
View File

@@ -1,27 +0,0 @@
var Datastore = require('nedb');
var path = require('path');
var Evt = require('evt');
// 数据库初始化
// var dbPath = require('nw.gui').App.dataPath + '/nedb';
// var dbPath = Evt.getBasePath() + '/Users/life/Library/Application Support/Leanote' + '/nedb';
var dbPath = Evt.getBasePath() + '/nedb';
console.error(dbPath);
// test
if(dbPath.length < 6) {
var dbPath = '/Users/life/Library/Application Support/Leanote' + '/nedb';
}
// console.log(dbPath);
// g, 表全局环境
var db = {};
var dbNames = ['notebooks', 'notes', 'users', 'tags', 'images', 'attachs', 'noteHistories', 'g'];
for(var i in dbNames) {
var name = dbNames[i];
var p = path.join(dbPath, name + '.db');
console.log(p);
db[name] = new Datastore({ filename: p, autoload: true });
}
module.exports = db;
console.log('db init');