Problem with directorydropped() on Windows
Posted: Sun Dec 22, 2024 12:10 pm
Hi there. New to LÖVE, but not to Lua, and writing an application to process astrophotography images in real time using shaders.
Need to access the file system, so using love.filesystem.directorydropped() to do so. It works just fine on a Mac, but fails under Windows.
I’ve condensed the problem code to a single function:
I’m using the standard Lua package.config to grab the appropriate file path separator '/' or '\' for the system.
Running on widows and dropping a folder with three files in it gives the following.
This seems very wrong.
An help/insights much appreciated.
Tony
Need to access the file system, so using love.filesystem.directorydropped() to do so. It works just fine on a Mac, but fails under Windows.
I’ve condensed the problem code to a single function:
Code: Select all
function love.directorydropped(folder)
local fileseparator = package.config:sub(1,1)
local mountpoint = "folder"
print "folder dropped "
local mount = love.filesystem.mount(folder, mountpoint)
print("mounted ", mount)
local dir = love.filesystem.getDirectoryItems(mountpoint)
for i, item in ipairs(dir) do
print(i, item)
end
local filename = dir[1]
local path = mountpoint .. fileseparator .. filename
local file, errorstr = love.filesystem.newFile(path, 'r')
print(tostring(file))
print(errorstr)
end
Running on widows and dropping a folder with three files in it gives the following.
Code: Select all
folder dropped
mounted true
1 a.txt
2 b.txt
3 c.txt
nil
Could not open file folder\a.txt. Does not exist.
An help/insights much appreciated.
Tony