Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

do fs.symlink works on windows(for folders) #2274

Closed
Befzz opened this issue Dec 5, 2011 · 10 comments
Closed

do fs.symlink works on windows(for folders) #2274

Befzz opened this issue Dec 5, 2011 · 10 comments

Comments

@Befzz
Copy link

Befzz commented Dec 5, 2011

Tryed to use fs.linkSync(), fs.symlinkSync() on windows7, but only errors captched...

Program Linkd.exe from Microsoft Windows 2000 Resource Kit can link folders on WinXP,Vista,7...
so... node must do this.

@bnoordhuis
Copy link
Member

You need to run node.exe with administrative rights for that to work.

@Bonuspunkt
Copy link

launched a shell as admin

mkdir dirA
node --eval "require('fs').symlinkSync('dirA', 'symA')"

this gives me a symlinked file named symA with size of 0bytes

node v0.6.5

i'd expect a symlink in of type "File folder" instead of "File" when a symlink for a Folder is created
it should stay "file" for a symlinked file

@bnoordhuis bnoordhuis reopened this Dec 13, 2011
@igorzi
Copy link

igorzi commented Dec 16, 2011

@Bonuspunkt for this reason fs.symlink has an additional mode argument (see https://github.com/joyent/node/wiki/API-changes-between-v0.4-and-v0.6 for more details).
Can you try this?

mkdir dirA
node --eval "require('fs').symlinkSync('dirA', 'symA', 'dir')"

(I'm going to make sure this is reflected in the docs).

@Mithgol
Copy link

Mithgol commented Dec 16, 2011

As far as I see in the corresponding section, it is not reflected in the docs.

@igorzi
Copy link

igorzi commented Dec 16, 2011

it is now - d6bae2c

@Mithgol
Copy link

Mithgol commented Dec 16, 2011

Thank you for the helpful bit of the documentation.

@Bonuspunkt
Copy link

@igorzi works as expected.

the problem is, if you enter the wrong type, the symlink is unusable.
i can life with it, but i'd be nice, if node would determine and handle it correctly

@ghost ghost assigned igorzi Dec 17, 2011
@igorzi
Copy link

igorzi commented Dec 17, 2011

Ok, I think we can improve the default for existing targets, and correctly pick 'file' or 'dir'. I'll get this fixed.

@AndrewGoal
Copy link

hi, everyone

fs.link() on windows use CreateHardLinkW
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363860(v=vs.85).aspx

"Establishes a hard link between an existing file and a new file. This function is only supported on the NTFS file system, and only for files, not directories."

So it dosen't work on directories .

@piscisaureus
Copy link

@AndrewGoal fs.link != fs.symlink.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants