Windows symlinks

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
raingloom
Prole
Posts: 36
Joined: Wed Apr 22, 2015 12:35 am
Location: Always elsewhere

Windows symlinks

Post by raingloom »

Sorry for another symlink question, but I'm having some trouble getting my project to run on Windows.
My main system is Linux and to reduce redundancy I symlink used libraries from a central folder. Of course this makes it harder for collaborators with different setups.... but there are no collaborators.
All projects are managed through Git and the current one is kept on GitHub, so I can sync it when I need to.

I am now trying to load my current (extremely simple) project on Windows 7. I've cloned my Git repository and managed to get Cygwin to create symlinks that Windows will understand. I can open the linked files in my editor (ZeroBrane), but I can't load them in Löve.

Require doesn't work, but the files end in ".lnk", so that could be a reason, but directly loading doesn't work either, even after I enabled symlinks.

Relevant code:

Code: Select all

--main.lua
local os = love.system.getOS()
local quirk = 'quirks/'..os..'.lua'
if love.filesystem.exists( quirk ) then
  print( 'fixing '..os..' quirks' )
  dofile( quirk )
end
dofile'lib/Vector2.lua.lnk'
os.exit( true, true )
--other stuff

Code: Select all

--quirks/Windows.lua
--fix symlink support for require
love.filesystem.setSymlinksEnabled( true )
package.path = package.path .. package.path:gsub( '.lua', '.lua.lnk' )
Output:

Code: Select all

--fix symlink support for require
love.filesystem.setSymlinksEnabled( true )
package.path = package.path .. package.path:gsub( '.lua', '.lua.lnk' )
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Windows symlinks

Post by zorg »

From wikipedia:
An NTFS symbolic link is not the same as a Windows shortcut file, which is a regular file. The latter may be created on any filesystem (such as the earlier FAT32), may contain metadata (such as an icon to display when the shortcut is viewed in Windows Explorer), and is not transparent to applications.
In short, using files having the .lnk extension means those are not symbolic links, but old shell links, or simple file shortcuts. (And they won't work with löve like how you expect them to)
Check out the Tools section of the wiki page i linked on how to create symbolic links, and try with those.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
raingloom
Prole
Posts: 36
Joined: Wed Apr 22, 2015 12:35 am
Location: Always elsewhere

Re: Windows symlinks

Post by raingloom »

Thanks, those tools are all fine and dandy, but what I want is to get Cygwin and Git to make symlinks that Windows can use too. If I made the links manually, Git would probably get confused and I don't want extra noise from changing between symlink formats.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Windows symlinks

Post by zorg »

Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests