Cannot remove a directory with love.filesystem?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Cannot remove a directory with love.filesystem?

Post by Eamonn »

So, this is really weird. I have a button that is supposed to clear all of the preferences that a user has. I have the preferences thing all setup, I'm sure I'm spelling everything correctly, but I just don't know why this isn't working. Here's a snippit from my code:

Code: Select all

-- This is the code for my button. It's a button made with LöveFrames, in case you're wondering.
-- The button shows up fine, but it prints "false" to the console, and doesn't delete the file.

clearPrefsButton:SetText("Clear Preferences")
clearPrefsButton:SetPos( optionsFrame:GetWidth()/2-150/2-200, optionsFrame:GetHeight()/2-30/2+70 )
clearPrefsButton:SetSize(150, 30)
clearPrefsButton.OnClick = function(object)
	if lf.exists("prefs/") then
		local success = lf.remove("assets")

		print(success)
	else
		print("Debug output!")
	end
end
Thanks! Any help is appreciated!
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: Cannot remove a directory with love.filesystem?

Post by mickeyjm »

Just a guess as I can't see the file structure itself but would you want

Code: Select all

lf.remove("prefs/assets")
as your code implies assets is in the pref directory but doesn't tell love to delete a file in that folder
Your screen is very zoomed in...
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests