Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e25aec

Browse files
committed
1 parent 07b9601 commit 3e25aec

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

project.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ exports.remove = function(path) {
225225
} else {
226226
exec('rm -rf -- ' + process.cwd() + path, function(err) {
227227
if (!err) {
228-
// TODO: Implement removal from list cache
228+
// Invalidate file list cache
229229
listCache = undefined
230230
ee.emit('success')
231231
} else {
@@ -247,6 +247,8 @@ exports.rename = function(oldpath, newpath) {
247247
} else {
248248
fs.rename(process.cwd() + oldpath, process.cwd() + newpath, function(err) {
249249
if (!err) {
250+
// Invalidate file list cache
251+
listCache = undefined
250252
ee.emit('success')
251253
} else {
252254
ee.emit('err', err)

public/js/nide.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ var renameFile = function(oldpath, newpath) {
212212
socket.emit('rename', { oldpath: oldpath, newpath: newpath })
213213
}
214214

215+
socket.on('rename-success', function(data) {
216+
selectFile({
217+
type: 'file',
218+
path: data.path
219+
}, fileHtmlElementByPath);
220+
})
221+
215222
var removeFile = function() {
216223
socket.emit('remove', currentFile.path)
217224
}

server.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ exports.listen = function(port) {
116116
project.rename(data.oldpath, data.newpath)
117117
.on('success', function(file) {
118118
project.list()
119-
.on('success', function(data) {
120-
socket.emit('list', data)
119+
.on('success', function(list) {
120+
socket.emit('list', list)
121+
socket.emit('rename-success', { path: data.newpath })
121122
})
122123
})
123124
.on('error', function(err) {

0 commit comments

Comments
 (0)