Please help me with using 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.
alex_
Prole
Posts: 19
Joined: Sat Jan 16, 2010 11:39 pm

Please help me with using love.filesystem?

Post by alex_ »

I have initialized properly (i believe) by having love.filesystem.setIdentity("folderName") in the love.load() callback

but when I try:

img=love.graphics.newScreenshot()
love.filesystem.write("folderName/img_rawData.txt", img)

it doesn't work!

It's a simple thing I'm doing, but where is it wrong?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Please help me with using love.filesystem?

Post by Robin »

1) You already save it to "folderName", so there is no need to use that:

Code: Select all

img=love.graphics.newScreenshot()
love.filesystem.write("img_rawData.txt", img)
2) I'm not sure if that works. If not, try:

Code: Select all

img=love.graphics.newScreenshot()
love.filesystem.write("img_rawData.txt", img:getString())
Help us help you: attach a .love.
alex_
Prole
Posts: 19
Joined: Sat Jan 16, 2010 11:39 pm

Re: Please help me with using love.filesystem?

Post by alex_ »

alright I will, thanks a lot!
alex_
Prole
Posts: 19
Joined: Sat Jan 16, 2010 11:39 pm

Re: Please help me with using love.filesystem?

Post by alex_ »

It's still not working!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Please help me with using love.filesystem?

Post by Robin »

Could you post your .love, so we can see what the problem is?
Help us help you: attach a .love.
alex_
Prole
Posts: 19
Joined: Sat Jan 16, 2010 11:39 pm

Re: Please help me with using love.filesystem?

Post by alex_ »

function love.load()
love.filesystem.setIdentity("imgData")
love.graphics.setCaption("Draw")
love.graphics.setBackgroundColor(255,255,255)
love.graphics.setColor(0,0,0)
pixels={}
love.keyboard.setKeyRepeat(1,1)
end

function love.update(dt)
mouseX=love.mouse.getX()
mouseY=love.mouse.getY()
if love.mouse.isDown("l") then
table.insert(pixels,{mouseX,mouseY})
end
end

function love.draw()
for index,value in ipairs(pixels) do
love.graphics.rectangle("fill",value[1],value[2],10,10)
end
end

function love.mousepressed()
end

function love.mousereleased()
end

function love.keypressed(key)
if key == "z" then
table.remove(pixels)
elseif key == "s" then
rawData=love.graphics.newScreenshot()
love.filesystem.write("img_rawData.txt",rawData:getString())
end
end
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Please help me with using love.filesystem?

Post by bartbes »

Didn't you have to make it EncodedImageData first?
laconix
Prole
Posts: 4
Joined: Fri Feb 05, 2010 6:19 am

Re: Please help me with using love.filesystem?

Post by laconix »

It works perfectly, remember love.filesystem stores your data in %appdata%/LOVE in windows. When you check there, there will be an 'imgData' folder with your 'img_rawData.txt' file.
alex_
Prole
Posts: 19
Joined: Sat Jan 16, 2010 11:39 pm

Re: Please help me with using love.filesystem?

Post by alex_ »

I should have mentioned this earlier, I'm not using windows, I'm using a mac.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Please help me with using love.filesystem?

Post by bmelts »

Well, on the Mac, it should store files in ~/Library/Application Support/LOVE. So, try looking there?
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests