aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-02-09 17:32:59 -0500
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-03-28 10:51:48 -0700
commite0d8b6dab84cdd364cbc634554d81c44d390d205 (patch)
tree6dcb974313812444cadab85714a8f9b67774f24d /src
parent93afa269f3fc18b40c0c86c920a1a0d565731dff (diff)
Enable logging of filesystem operations
Diffstat (limited to 'src')
-rw-r--r--src/library.js36
-rw-r--r--src/settings.js3
2 files changed, 36 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js
index 0574bb8d..184cd91d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -86,6 +86,23 @@ LibraryManager.library = {
parentPath: null,
parentObject: null
};
+#if FS_LOG
+ var inputPath = path;
+ function log() {
+ print('FS.analyzePath("' + inputPath + '", ' +
+ dontResolveLastLink + ', ' +
+ linksVisited + ') => {' +
+ 'isRoot: ' + ret.isRoot + ', ' +
+ 'exists: ' + ret.exists + ', ' +
+ 'error: ' + ret.error + ', ' +
+ 'name: "' + ret.name + '", ' +
+ 'path: "' + ret.path + '", ' +
+ 'object: ' + ret.object + ', ' +
+ 'parentExists: ' + ret.parentExists + ', ' +
+ 'parentPath: "' + ret.parentPath + '", ' +
+ 'parentObject: ' + ret.parentObject + '}');
+ }
+#endif
path = FS.absolutePath(path);
if (path == '/') {
ret.isRoot = true;
@@ -123,8 +140,12 @@ LibraryManager.library = {
break;
}
var link = FS.absolutePath(current.link, traversed.join('/'));
- return FS.analyzePath([link].concat(path).join('/'),
- dontResolveLastLink, linksVisited + 1);
+ ret = FS.analyzePath([link].concat(path).join('/'),
+ dontResolveLastLink, linksVisited + 1);
+#if FS_LOG
+ log();
+#endif
+ return ret;
}
traversed.push(target);
if (path.length == 0) {
@@ -133,8 +154,10 @@ LibraryManager.library = {
ret.object = current;
}
}
- return ret;
}
+#if FS_LOG
+ log();
+#endif
return ret;
},
// Finds the file system object at a given path. If dontResolveLastLink is
@@ -152,6 +175,13 @@ LibraryManager.library = {
},
// Creates a file system record: file, link, device or folder.
createObject: function(parent, name, properties, canRead, canWrite) {
+#if FS_LOG
+ print('FS.createObject("' + parent + '", ' +
+ '"' + name + '", ' +
+ JSON.stringify(properties) + ', ' +
+ canRead + ', ' +
+ canWrite + ')');
+#endif
if (!parent) parent = '/';
if (typeof parent === 'string') parent = FS.findObject(parent);
diff --git a/src/settings.js b/src/settings.js
index b8dbe06e..66b53218 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -136,6 +136,9 @@ var CORRECT_OVERFLOWS = 1; // Experimental code that tries to prevent unexpected
var CORRECT_ROUNDINGS = 1; // C rounds to 0 (-5.5 to -5, +5.5 to 5), while JS has no direct way to do that:
// Math.floor is to negative, ceil to positive. With CORRECT_ROUNDINGS,
// we will do slow but correct C rounding operations.
+var FS_LOG = 0; // Log all FS operations. This is especially helpful when you're porting
+ // a new project and want to see a list of file system operations happening
+ // so that you can create a virtual file system with all of the required files.
var PGO = 0; // Profile-guided optimization.
// When run with the CHECK_* options, will not fail on errors. Instead, will