index.js
function(key,onlyCheckDirectory) {
        var filePath = this.loadVar(key);
        if (!filePath) {
            exitProcess('empty file path for ' + key, this.alarm);
            return false;
        }
        if (!onlyCheckDirectory) {
            if (!fs.existsSync(filePath)) {
                exitProcess('the value of ' +key+' is a necessary file ,but not exists in '+ filePath, this.alarm);
                return false;
            }
        } else {
            var dirname = path.dirname(filePath);
            if (!fs.lstatSync(dirname).isDirectory()) {
                exitProcess('the path '+dirname + ' must exist and be a directory', this.alarm);
                return false;
            }
        }

        return filePath;
    }
function(key,onlyCheckDirectory) {
        var filePath = this.loadVar(key);
        if (!filePath) {
            exitProcess('empty file path for ' + key, this.alarm);
            return false;
        }
        if (!onlyCheckDirectory) {
            if (!fs.existsSync(filePath)) {
                exitProcess('the value of ' +key+' is a necessary file ,but not exists in '+ filePath, this.alarm);
                return false;
            }
        } else {
            var dirname = path.dirname(filePath);
            if (!fs.lstatSync(dirname).isDirectory()) {
                exitProcess('the path '+dirname + ' must exist and be a directory', this.alarm);
                return false;
            }
        }

        return filePath;
    }
Get file path by key, the value must be exist, otherwise the process will exit.

@param {KeyItem} key
@param {Boolean} [onlyCheckDirectory=false] If set true, only check whether the directory that the file saved is exist.
@returns {String}