instead, will return every source file plus the save folder files, how can I manage to get only from save folder?
I've tried passing to "save/" and "saves/" as parameters, but it doesn't seem to work
Best solution is to create a dedicated save directory when your game starts.
In cases where that's not sufficient, you can use love.filesystem.getRealDirectory to check the real location of each file.
-- Get all files in the "levels" folder.
-- There might be a "levels" folder in both the save directory and the game's source,
-- in which case this will get all files in both.
local filepaths = love.filesystem.getDirectoryItems("levels")
for i, filename in ipairs(filepaths) do
-- For each filename, check whether it's in the save directory or not.
local path = "levels/"..filename
if love.filesystem.getRealDirectory(path) == love.filesystem.getSaveDirectory() then
-- This file is in the save directory.
end
end
Me and my stuff True 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.
as grump said you dont need that check at all, just make a unique folder in the save directory. name your folder something useful like the version of your game (in case the save format changes)
True, but if one doesnt want to do it that way, then it is best to expand on that alt answer... also they private messaged me so i felt like answering here instead, as i already said.
Me and my stuff True 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.