Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

love2d doesn't list items inside the root level of a symlink on Windows #1938

Open
sewbacca opened this issue May 31, 2023 · 1 comment
Open
Labels
bug Something isn't working library dependency Related to a library used by LÖVE

Comments

@sewbacca
Copy link
Contributor

First of all, I love love2d, it is a great engine!
Issue
love.filesystem.getDirectoryItems() won't list any files inside a symlink, except if it is at least one level in. Symlinks are enabled. I am using love 11.4 on Windows 10.

Reproduce

  1. Create a new folder
  2. Create a file with subdirectories: real/inner/test.txt
  3. Create a directory symlink with mklink /D sym real
  4. Create main.lua
print("Real dir: "..#love.filesystem.getDirectoryItems 'real')
print("Real dir inner: "..#love.filesystem.getDirectoryItems 'real/inner')
print("Sym dir: "..#love.filesystem.getDirectoryItems 'sym')
print("Sym dir inner: "..#love.filesystem.getDirectoryItems 'sym/inner')

love.event.quit()
  1. Run lovec .

Expected output:

Real dir: 1
Real dir inner: 1
Sym dir: 1
Sym dir inner: 1

Actual output

Real dir: 1
Real dir inner: 1
Sym dir: 0
Sym dir inner: 1
@slime73
Copy link
Member

slime73 commented May 31, 2023

This is probably where it's failing - the filetype would be symlink rather than directory, so physfs doesn't try to enumerate it as a directory:

if (statbuf.filetype != PHYSFS_FILETYPE_DIRECTORY)
continue; /* not a directory in this archive, skip it. */

@slime73 slime73 added bug Something isn't working library dependency Related to a library used by LÖVE labels May 31, 2023
Daaaav pushed a commit to Daaaav/Ved that referenced this issue Oct 26, 2023
Due to a bug in LÖVE that goes down to PhysFS[1], a symlinked directory
isn't recognized as a directory, so symlinked plugin directories won't
be loaded.

To fix this, just load it anyway if it's a symlink. If the symlink turns
out to be a file, that's harmless because it will just be loaded as an
unknown plugin that does nothing.

[1]: love2d/love#1938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working library dependency Related to a library used by LÖVE
Projects
None yet
Development

No branches or pull requests

2 participants