blob: ed0430b947ba0cec5f12f9629c740564f873f088 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
'use strict';
const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
// test creating and reading symbolic link
const linkData = path.join(common.fixturesDir, 'cycles/');
const linkPath = path.join(common.tmpDir, 'cycles_link');
common.refreshTmpDir();
console.log('linkData: ' + linkData);
console.log('linkPath: ' + linkPath);
fs.symlink(linkData, linkPath, 'junction', common.mustCall(function(err) {
assert.ifError(err);
fs.lstat(linkPath, common.mustCall(function(err, stats) {
assert.ifError(err);
assert.ok(stats.isSymbolicLink());
fs.readlink(linkPath, common.mustCall(function(err, destination) {
assert.ifError(err);
assert.strictEqual(destination, linkData);
fs.unlink(linkPath, common.mustCall(function(err) {
assert.ifError(err);
assert(!common.fileExists(linkPath));
assert(common.fileExists(linkData));
}));
}));
}));
}));
|