function love.load(arg)
love.filesystem.setIdentity("fileTest")
str = string.char(72,101,108,108,111,10) -- "Hello\n"
local result = love.filesystem.write("test.bin",str)
print(result)
love.window.close()
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.
@zorg it ended up not doing anything. I moved the print command to a love.draw function, and remove the window closing, but it still came up with nothing displayed
Your Code works on my machine. Have you looked in the right place (see: https://love2d.org/wiki/love.filesystem)? The file test.bin is not saved where the .love file is. You have to look in the save directory of love.
Xugro wrote:Your Code works on my machine. Have you looked in the right place (see: https://love2d.org/wiki/love.filesystem)? The file test.bin is not saved where the .love file is. You have to look in the save directory of love.
Thank you, I found it in the path specified. Is there a way I can change it to use the path of the source or .love file?
Through the FFI, you can do that, but it has some issues, mainly that you can't guarantee the OS gives your program the rights to actually edit/modify files in that folder, or that the folder you want to be writable won't be the one the below code sets, and that if you have files opened elsewhere, changing the writable directory will fail.
With that said, something like thismight work.
I'd only ever use this for some personal projects of mine, where i know what the damage this might be able to cause
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.
Thank you for the replies! If I end up doing a music editing program, I'll probably use it as a fused-exe, because from what I understand, you can have it read/write files in the same directory