Page 1 of 1

Directory path

Posted: Fri Aug 28, 2015 11:21 pm
by randomNick
So i tried this code to list the files in a certain directory

Code: Select all

local dir = ""

local files = love.filesystem.getDirectoryItems(dir)

function love.draw()
	for i,v in ipairs(files) do
		love.graphics.print(v, 0, i*10)
	end
end
this one works, but if i change the dir to something like: "C:/Users/Username/Documents" it doesnt list anything. and i also tried giving the complete directory to the main folder and it doesnt work too.

Re: Directory path

Posted: Sat Aug 29, 2015 1:52 am
by randomNick
So i realized that love can only access the save directory and the .love's root directory.

so i change the code to

Code: Select all

love.filesystem.setIdentity("testFolder")

local files = love.filesystem.getDirectoryItems("")

function love.draw()
	for i,v in ipairs(files) do
		love.graphics.print(v, 0, i*10)
	end
end
and it read files from testFolder and the folder where i have the main.lua. that's ok, but when i made the .exe file it stopped working (worked fine .love)

what else do i have to change

Re: Directory path

Posted: Sat Aug 29, 2015 2:00 am
by davisdude
Files are read from a different directory when in .exe's vs .love's. That might be the issue.

Re: Directory path

Posted: Sat Aug 29, 2015 4:42 am
by randomNick
indeed

.love is saving to AppData/Roaming/LOVE while
.exe is saving to AppData/Roaming

Re: Directory path

Posted: Sat Aug 29, 2015 8:05 am
by T-Bone
To be more precise, the paths are AppData/Roaming/LOVE/yourgameID/ and AppData/Roaming/yourgameID/ respectively.