mirror of
https://github.com/slap-editor/slap.git
synced 2024-09-11 04:45:47 +03:00
Merge pull request #240 from slap-editor/issue-213
@alicesypark's Issue #213 (merged master)
This commit is contained in:
commit
f55fe0552d
@ -68,10 +68,10 @@ var Pane = require('./ui/Pane');
|
||||
module.exports = function (options) {
|
||||
opts = _.merge(opts, options);
|
||||
return Slap.getUserDir().catch(Promise.resolve()).then(function (userDir) {
|
||||
|
||||
if (userDir) opts = _.merge({logger: {file: path.resolve(userDir, package.name+'.log')}}, opts);
|
||||
opts = _.merge({editor: {logger: opts.logger}}, opts);
|
||||
util.logger(opts.logger);
|
||||
|
||||
util.logger.info("loading...");
|
||||
util.logger.verbose("configuration:", opts);
|
||||
|
||||
|
@ -11,6 +11,8 @@ var util = require('slap-util');
|
||||
var BaseWidget = require('base-widget');
|
||||
var Editor = require('editor-widget');
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
function Slap (opts) {
|
||||
var self = this;
|
||||
|
||||
@ -52,6 +54,10 @@ Slap.prototype.open = Promise.method(function (filePath, current) {
|
||||
|
||||
var pane = self.paneForPath(filePath);
|
||||
pane = pane || new Pane({parent: self});
|
||||
if (fs.lstatSync(filePath).isDirectory()) { // check if filePath is a directory
|
||||
self.fileBrowser.refresh(filePath, _.noop); // open the directory on the sidebar
|
||||
return;
|
||||
}
|
||||
return pane.editor.open(filePath)
|
||||
.then(function () {
|
||||
if (current) pane.setCurrent();
|
||||
|
Loading…
Reference in New Issue
Block a user