Ok, tell me, what is the filename and content when error is thrown (eg add print with all parameters as in love.filesystem.write to print with error)zalander wrote: ↑Sat Jun 17, 2023 5:28 pmThe file name can differ as the user enters it.Andlac028 wrote: ↑Sat Jun 17, 2023 2:19 pmAnd what is the filename?zalander wrote: ↑Sat Jun 17, 2023 4:32 am I added this to the love.update function and it tells me that the file name is illegal or is insecureCode: Select all
if love.keyboard.isDown("return") then local success, message = love.filesystem.write(game.file_n, game.txt) if success then print("File saved successfully!") else print("Error saving file:", message) end end
File wont save [SLOVED]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: File wont save
Re: File wont save
https://love2d.org/wiki/love.filesystemThe file name can differ as the user enters it.
prob need to sanitize the user input. love.filesystem.write will only write to specific directories (detailed in docs above) and it sounds like the path being specified isn't one of them.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: File wont save
It should only be a filename, and not a full path though; otherwise most characters should be accepted as names anyway.
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.
Re: File wont save
its just the file name not the full path
Using LOVE to make everything except games
Code: Select all
astring = "pog"
print(astring)
--pog
Re: File wont save
ohhh i got it my code adds a "\b" that needs to be removed before saving the file thanks for the help guys !
Using LOVE to make everything except games
Code: Select all
astring = "pog"
print(astring)
--pog
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: File wont save
You're welcome, although for future reference, playing one question - one partial answer might not be the best of ideas; i believe that if you posted all relevant code we might have solved this in just one post.
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot] and 6 guests