aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael J. Bishop <mbtyke@gmail.com>2013-10-10 14:53:00 -0400
committerJukka Jylänki <jujjyl@gmail.com>2014-04-29 14:57:55 +0300
commit583efabba5f0da11fecdebbe1ff3d1c846bfbd1e (patch)
tree4cd3cd06fab3656dbef428beefa6b29e983f0b22 /src
parentfa9b6011557011c2e65963ab15a1856d33d442b9 (diff)
Added support for moving paths.
Removed specific callbacks for directories and files, opting instead for callbacks that apply to generic paths.
Diffstat (limited to 'src')
-rw-r--r--src/library_fs.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/library_fs.js b/src/library_fs.js
index e5c17506..6c083ed5 100644
--- a/src/library_fs.js
+++ b/src/library_fs.js
@@ -719,6 +719,8 @@ mergeInto(LibraryManager.library, {
throw new FS.ErrnoError(err);
}
}
+ if (FS.trackingDelegate['willMovePath'])
+ FS.trackingDelegate['willMovePath'](old_path, new_path);
// remove the node from the lookup hash
FS.hashRemoveNode(old_node);
// do the underlying fs rename
@@ -730,14 +732,8 @@ mergeInto(LibraryManager.library, {
// add the node back to the hash (in case node_ops.rename
// changed its name)
FS.hashAddNode(old_node);
- }
- if (FS.trackingDelegate) {
- if (FS.trackingDelegate['didDeleteFile'])
- FS.trackingDelegate['didDeleteFile'](old_path);
- if (FS.trackingDelegate['didOpenFile'])
- FS.trackingDelegate['didOpenFile'](new_path, FS.tracking.openFlags.WRITE);
- if (FS.trackingDelegate['didCloseFile'])
- FS.trackingDelegate['didCloseFile'](new_path);
+ if (FS.trackingDelegate['didMovePath'])
+ FS.trackingDelegate['didMovePath'](old_path, new_path);
}
},
rmdir: function(path) {
@@ -755,8 +751,14 @@ mergeInto(LibraryManager.library, {
if (FS.isMountpoint(node)) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
+ if (FS.trackingDelegate['willDeletePath']) {
+ FS.trackingDelegate['willDeletePath'](path);
+ }
parent.node_ops.rmdir(parent, name);
FS.destroyNode(node);
+ if (FS.trackingDelegate['didDeletePath']) {
+ FS.trackingDelegate['didDeletePath'](path);
+ }
},
readdir: function(path) {
var lookup = FS.lookupPath(path, { follow: true });
@@ -783,10 +785,13 @@ mergeInto(LibraryManager.library, {
if (FS.isMountpoint(node)) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
+ if (FS.trackingDelegate['willDeletePath']) {
+ FS.trackingDelegate['willDeletePath'](path);
+ }
parent.node_ops.unlink(parent, name);
FS.destroyNode(node);
- if (FS.trackingDelegate && FS.trackingDelegate['didDeleteFile']) {
- FS.trackingDelegate['didDeleteFile'](path);
+ if (FS.trackingDelegate['didDeletePath']) {
+ FS.trackingDelegate['didDeletePath'](path);
}
},
readlink: function(path) {