session history: wrong dedupe
This commit is contained in:
parent
c1ca0aaecd
commit
856627604b
1 changed files with 1 additions and 3 deletions
|
|
@ -43,18 +43,16 @@ module.exports = {
|
|||
|
||||
var recentSessions = settings.read('recentSessions')
|
||||
|
||||
fs.lstat(data,(err, stats)=>{
|
||||
fs.lstat(data, (err, stats)=>{
|
||||
|
||||
if (err || !stats.isFile()) return
|
||||
|
||||
// add session to history
|
||||
recentSessions.unshift(path.resolve(data))
|
||||
// remove doubles from history
|
||||
recentSessions = recentSessions.reverse()
|
||||
recentSessions = recentSessions.filter(function(elem, index, self) {
|
||||
return index == self.indexOf(elem)
|
||||
})
|
||||
recentSessions = recentSessions.reverse()
|
||||
|
||||
// history size limit
|
||||
if (recentSessions.length > 10) recentSessions = recentSessions.slice(0, 10)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue