How to use the evt.getDBPath function in evt

To help you get started, we’ve selected a few evt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leanote / desktop-app / node_modules / db.js View on Github external
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';
// nedb2 为了port
var dbPath = Evt.getDBPath();
// console.error(dbPath);

// test
if(dbPath.length < 6) {
	var dbPath = '/Users/life/Library/Application Support/Leanote' + '/nedb2';
}

// console.log(dbPath);
// g, 表全局环境
var db = {

    // 为全部用户共有的表初始化
    initGlobal: function () {
        var me = this;
        var dbNames = ['users', 'g'];
        this.initIt(me, dbNames);
github leanote / desktop-app / node_modules / user.js View on Github external
getUserDataStats: function (user) {
		var me = this;
		var userId = user.UserId;
		var dbPath = user.HasDB ? me.getUserDBPath(userId) : Evt.getDBPath();
		var dbSize = Common.getFolderSize(dbPath);

		var imageSize = Common.getFolderSize(me.getUserImagesPath(userId));
		var attachSize = Common.getFolderSize(me.getUserAttachsPath(userId));

		return {
			db: dbSize, 
			image: imageSize,
			attach: attachSize
		};
	},
github leanote / desktop-app / node_modules / user.js View on Github external
me.getUser(userId, function (user) {
			if (!user) {
				return callback(false);
			}
			if (user.HasDB) {
				callback(me.getUserDBPath(userId));
			}
			else {
				callback(Evt.getDBPath());
			}
		});
	},
github leanote / desktop-app / node_modules / user.js View on Github external
getUserDBPath: function (userId) {
		var base = Evt.getDBPath();
		if (!base) {
			return false;
		}
		return base + '/' + userId;
	},