Skip to content

Commit d7ab3c0

Browse files
committed
fix: 'rename' was forgetting to save the superblock
1 parent 24c4c05 commit d7ab3c0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ module.exports = class FS {
5555
});
5656
return [filepath, opts, cb];
5757
}
58+
_cleanParams2(oldFilepath, newFilepath, cb, stopClock = null, save = false) {
59+
oldFilepath = path.normalize(oldFilepath);
60+
newFilepath = path.normalize(newFilepath);
61+
const _cb = cb;
62+
cb = once((...args) => {
63+
if (stopClock) stopClock();
64+
if (save) this.saveSuperblock();
65+
_cb(...args);
66+
});
67+
return [oldFilepath, newFilepath, cb];
68+
}
5869
_wipe() {
5970
return this._backend.wipe().then(() => {
6071
if (this._fallback) {
@@ -205,6 +216,7 @@ module.exports = class FS {
205216
.catch(cb);
206217
}
207218
rename(oldFilepath, newFilepath, cb) {
219+
[oldFilepath, newFilepath, cb] = this._cleanParams2(oldFilepath, newFilepath, cb, null, true);
208220
this.superblockPromise
209221
.then(() => {
210222
try {

0 commit comments

Comments
 (0)