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