Skip to content

Commit

Permalink
Illustrate symlink behavior on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
elierotenberg committed Oct 2, 2020
0 parents commit 8df3052
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
In a non-admin shell:
```
node test-dir.js
> Error: EPERM: operation not permitted, symlink 'XXX\srcDir' -> 'XXX\destDir'
node test-file.js
> Error: EPERM: operation not permitted, symlink 'XXX\srcFile' -> 'XXX\destFile'
node test-junction.js
> (no error, link created)
```

All commands work fine in an admin shell.
Empty file added srcDir/.gitkeep
Empty file.
Empty file added srcFile
Empty file.
Empty file added srcJunction/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions test-dir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require("fs");
const path = require("path");

const src = path.resolve(__dirname, "srcDir");
const dest = path.resolve(__dirname, "destDir");

fs.symlinkSync(src, dest);
7 changes: 7 additions & 0 deletions test-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require("fs");
const path = require("path");

const src = path.resolve(__dirname, "srcFile");
const dest = path.resolve(__dirname, "destFile");

fs.symlinkSync(src, dest);
7 changes: 7 additions & 0 deletions test-junction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require("fs");
const path = require("path");

const src = path.resolve(__dirname, "srcDir");
const dest = path.resolve(__dirname, "destDir");

fs.symlinkSync(src, dest, "junction");

0 comments on commit 8df3052

Please sign in to comment.