Skip to content

Commit

Permalink
fix open lastfile bug when filepath is not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
excaliburhan committed Sep 30, 2016
1 parent 8c13afc commit b0931a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</script>
</head>
<body>
<!-- <div class="test"></div> -->
<div class="test"></div>
<div id="ruler"></div>
<div id='body'>
<div id='line'>
Expand Down
13 changes: 3 additions & 10 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,9 @@ module.exports = {
// open lastFile
if (system.lastFile) {
try {
fs.statSync(system.lastFile, err => {
if (err) {
console.log(err)
util.setSystem({
lastFile: null,
})
} else if (~system.lastFile.indexOf('.md')) {
editor.loadFile(system.lastFile)
}
})
if (!fs.statSync(system.lastFile).isDirectory() && ~system.lastFile.indexOf('.md')) {
editor.loadFile(system.lastFile)
}
} catch (ex) {
console.log(ex)
util.setSystem({
Expand Down
2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"lastFile":null}
{"lastFile":null}

0 comments on commit b0931a3

Please sign in to comment.