Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add options.hardlinks boolean for treating hardlinks as Link or File

  • Loading branch information...
commit 40311b50a48804c658335ee4a741f170a4cc5452 1 parent 695b85e
@maxogden maxogden authored isaacs committed
Showing with 4 additions and 2 deletions.
  1. +1 −0  lib/dir-reader.js
  2. +3 −2 lib/reader.js
View
1  lib/dir-reader.js
@@ -212,6 +212,7 @@ DirReader.prototype.getChildProps = function (stat) {
, follow: this.follow
, filter: this.filter
, sort: this.props.sort
+ , hardlinks: this.props.hardlinks
}
}
View
5 lib/reader.js
@@ -142,7 +142,6 @@ Reader.prototype._stat = function (currentStat) {
var me = this
, props = me.props
, stat = props.follow ? "stat" : "lstat"
-
// console.error("Reader._stat", me._path, currentStat)
if (currentStat) process.nextTick(statCb.bind(null, null, currentStat))
else fs[stat](me._path, statCb)
@@ -163,8 +162,10 @@ Reader.prototype._stat = function (currentStat) {
me.size = props.size
var type = getType(props)
+ var handleHardlinks = props.hardlinks !== false
+
// special little thing for handling hardlinks.
- if (type !== "Directory" && props.nlink && props.nlink > 1) {
+ if (handleHardlinks && type !== "Directory" && props.nlink && props.nlink > 1) {
var k = props.dev + ":" + props.ino
// console.error("Reader has nlink", me._path, k)
if (hardLinks[k] === me._path || !hardLinks[k]) hardLinks[k] = me._path
Please sign in to comment.
Something went wrong with that request. Please try again.