INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Symlinks - can we get them fixed?  (Read 1698 times)

Daydream

  • Citizen of the Universe
  • *****
  • Posts: 770
Symlinks - can we get them fixed?
« on: May 04, 2012, 01:46:49 am »

Two issues here.

1) When I choose a symlink folder as an import point that symlink gets "resolved" instead of being preserved as-is.
2) Whatever entries are from that point on, they get duplicated in the library; I get the [symlink]\[content] but also the [original path]\[content]. Suddenly my music library doubled.

This is not new; reported the first time two years ago. Still happening.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42027
  • Shoes gone again!
Re: Symlinks - can we get them fixed?
« Reply #1 on: May 04, 2012, 10:59:47 am »

If you type the name in, it works fine.

It's just that the browse dialog resolves the link.

SHBrowseForFolder(...) returns a PIDL.  SHGetPathFromIDList(...) turns a PIDL into a path.

I'm not sure how to tell it not to resolve the symlink.

Anyone know?
Logged
Matt Ashland, JRiver Media Center

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Symlinks - can we get them fixed?
« Reply #2 on: May 04, 2012, 11:17:17 am »


http://msdn.microsoft.com/en-us/library/windows/desktop/bb762115%28v=vs.85%29.aspx

Quote
If SHBrowseForFolder returns a PIDL to a shortcut, sending that PIDL to SHGetPathFromIDList returns the path of the shortcut itself rather than the path of its target. The path to the shortcut's target can be obtained by using the IShellLink interface as shown in this example.
Logged
The opinions I express represent my own folly.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42027
  • Shoes gone again!
Re: Symlinks - can we get them fixed?
« Reply #3 on: May 04, 2012, 11:22:03 am »

Beautiful.

If we set BIF_NOTRANSLATETARGETS, it all falls together.

Next build:
Changed: Symlinks are no longer resolved when using the Browse Folder interface, so importing from a symlink will use the symlink path in the library instead of the resolved path.
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42027
  • Shoes gone again!
Re: Symlinks - can we get them fixed?
« Reply #4 on: May 04, 2012, 11:25:16 am »

As for the duplication issue, you'll have to manage that yourself.  Just be careful to only use the paths you want.

There isn't a universal file resource GUID other than the filename, so I don't think there's an automatic solution that doesn't come with performance or complexity trade-offs.

For example, at home, these paths are all the same thing:
D:\Media
\\Main\\Media
M:\

I'm just careful to use only M:\ inside Media Center.
Logged
Matt Ashland, JRiver Media Center

Daydream

  • Citizen of the Universe
  • *****
  • Posts: 770
Re: Symlinks - can we get them fixed?
« Reply #5 on: May 05, 2012, 12:20:22 am »

Hey Matt, big thanks for the quick fix!

Now on the duplication issue, this turn up to be really weird. So I'll go into more details bellow and maybe we make some sense out of what I see.

The way this happens is that I added the source just once (the symlink) and the files appeared twice. This didn't make any sense.

So I set up a test library and imported just the symlink folder, say D:\Media\!Audio\. D:\Media is a real folder. '!Audio' is a simlink to \\Source\e\!Audio
And to my surprise I could not replicate the issue. The files imported just once, with the resolved path (on my .144 build). What the heck? So then I went and mirrored more of my Main library import paths. So here's how this looks:

D:\Media\!Audio (!Audio symlink to \\Source\e\!Audio; network location on my server)
D:\Media\Movies\ (many other symlink subfolders in here)
D:\Media\Series\ (many other symlink subfolders in here)
D:\Media\Music Videos (Music Videos symlink to \\Source\p\!MusicVideos; network location on my server)

So the green folders are symlinks, the rest are real. With a scheme like that the music files in D:\Media\!Audio are imported twice, even on the test library.

So I guess my question is: when the 'root' point (here D:\Media\) containes both real folders and symlinks, is there something that confuses the import mechanism to import the symlinks twice, as-is and resolved?

Many thanks for all the help.
Logged
Pages: [1]   Go Up