Windows Shortcuts in FolderItem path

I’m sending a path String to a Windows host via URLConnection and I want it to look for a file inside the “C:\ProgramData\Avatars” folder and it works fine.

Now I want to store the Avatars folder on a different drive, so I have set up a Shortcut to the new folder as “C:\ProgramData\Avatars.lnk”, but Windows won’t resolve this. I can’t use FolderItem.ChildAt(Avatars.lnk) because it’s being executed on a different computer.

Is there a workaround to place Shortcuts inside a FolderItem path?

You probably want to use a Symbolic Link for that and not a Shortcut file.

A Shortcut file is only processed in the Windows shell, which is why it’s not resolved for you in Xojo. A Symbolic Link is handled by the filesystem.

You could use WindowsShortCutMBS class in our plugins to check the content to the link file.

You can also resolve it manually. If you read the shortcut file as text, you can use regex to extract the actual path from its contents.

My problem is that I’m getting the host to run an SQL command to return the Avatar PNG from a file using the ReadBlobMBS:

SQLCommand = "SELECT id, PreferredName, HEX(ReadBlobMBS(null, """ + Session.BaseLocationAvatars + "\" + """ || SUBSTR(""0000000000"" || CAST(id AS TEXT) || "".png"", -14))) AS AvatarPicture FROM Users" 'retrieves the Avatar from a file!

I’m not sure how WindowsShortCutMBS will help me as I already have the Shortcut. I could get the server to see the SQL command and do a custom extract, but I lose the one line SQL call. I’ll check out using a Symbolic Link.

Sorry, it won’t help within the SQL.

The Symbolic Link worked where the Shortcut (with its .lnk extension) did not. For those looking in the future here is what I did on my Windows host:

My Windows host in London has my home NAS mounted via SMB (via MountainDuck). Using a symbolic link means my WebApp has essentially unlimited file space (32 TB for £1500), which would be prohibitively expensive if I rented that much space. It is slower, but not much since the files are small and MountainDuck does intelligent caching.

PS I renamed the symbolic link file I created called ‘Link’ to ‘Avatars’.