So I zipped my Love2D project and it works when I launch it in the same folder, but elsewhere my io.open doesn't work. Here's my file system:
...
utils
|json.lua <-- library I use for encoding and decoding
|JSONHandler.lua
|parameters.json
conf.lua
main.lua
...
I get my error in JSONHandler.lua where I have:
local json = require "utils/json"
Handler = {
filename = "utils/parameters.json",
params = {},
...
}
function Handler:init()
local o = {}
setmetatable(o, self)
self.__index = self
local file = io.open(self.filename, "r")
local content = file:read("a")
...
My file ends up being nil
I tried many different relative paths for filename but nothing worked so I'm wondering how .love files handle paths, how should I track to my parameters.json?
parameters.jsoninside the zip archive?