1 | var path = require('path');
|
2 | var util = require('util');
|
3 |
|
4 | var Item = require('./item');
|
5 |
|
6 | var constants = process.binding('constants');
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function SymbolicLink() {
|
15 | Item.call(this);
|
16 |
|
17 | |
18 |
|
19 |
|
20 |
|
21 | this._path = undefined;
|
22 |
|
23 | }
|
24 | util.inherits(SymbolicLink, Item);
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | SymbolicLink.prototype.setPath = function(pathname) {
|
32 | this._path = pathname;
|
33 | };
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | SymbolicLink.prototype.getPath = function() {
|
41 | return this._path;
|
42 | };
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | SymbolicLink.prototype.getStats = function() {
|
50 | var size = this._path.length;
|
51 | var stats = Item.prototype.getStats.call(this);
|
52 | stats.mode = this.getMode() | constants.S_IFLNK;
|
53 | stats.size = size;
|
54 | stats.blocks = Math.ceil(size / 512);
|
55 | return stats;
|
56 | };
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | exports = module.exports = SymbolicLink;
|