Skip to content

Node.js based forum software built for the modern web

Merge remote-tracking branch 'origin/master' into develop

Julian Lam8a0a74d95ea9
diff --cc src/file.js
index a231ddd01d,d8fa128e5e..4044779ab3
--- a/src/file.js
+++ b/src/file.js
@@@ -98,16 -92,27 +98,29 @@@ file.exists = function (path, callback
};
file.existsSync = function (path) {
- var exists = false;
try {
- exists = fs.statSync(path);
- } catch(err) {
- exists = false;
+ fs.statSync(path);
+ } catch (err) {
+ if (err.code === 'ENOENT') {
+ return false;
+ }
+ throw err;
}
- return !!exists;
+ return true;
};
+ file.link = function link(filePath, destPath, cb) {
+ if (process.platform === 'win32') {
+ fs.link(filePath, destPath, cb);
+ } else {
+ fs.symlink(filePath, destPath, 'file', cb);
+ }
+ };
+
+ file.linkDirs = function linkDirs(sourceDir, destDir, callback) {
+ var type = (process.platform === 'win32') ? 'junction' : 'dir';
+ fs.symlink(sourceDir, destDir, type, callback);
+ };
+
module.exports = file;