Sorry if there was thread like this, but I found nothing on keywords "archive", "accessing LOVE archive" and etc.
I have "levels" directory in my LOVE archive, where I store my game levels. I need to read those files. I know how to read and write files in %APPDATA% directory, but is there any way to open files stored in .LOVE archive? Is this related to love.filesystem.mount?
Thanks in advance, and sorry for my bad english.
Accessing LOVE archive files
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Accessing LOVE archive files
You should just be able to use love.filesystem.load:
https://love2d.org/wiki/love.filesystem.load
It will check the save directory for the file and then if it cannot find it, it will also check the root directory of your archive.
EDIT: if you're already using this function and it stopped working when you made an archive, make sure you check capitalisation. Windows isn't case sensitive, and will gladly open "someFile.dat" if you say love.filesystem.load( "somefile.dat" ), but the archive is case sensitive and will stumble over the missing capital F.
https://love2d.org/wiki/love.filesystem.load
It will check the save directory for the file and then if it cannot find it, it will also check the root directory of your archive.
EDIT: if you're already using this function and it stopped working when you made an archive, make sure you check capitalisation. Windows isn't case sensitive, and will gladly open "someFile.dat" if you say love.filesystem.load( "somefile.dat" ), but the archive is case sensitive and will stumble over the missing capital F.
Re: Accessing LOVE archive files
But it loads LUA's file function, and I need just a single txt file.
Re: Accessing LOVE archive files
http://www.love2d.org/wiki/love.filesystem.read
I recommend you read the wiki on love.filesystem http://www.love2d.org/wiki/love.filesystem
I recommend you read the wiki on love.filesystem http://www.love2d.org/wiki/love.filesystem
Re: Accessing LOVE archive files
Already done. Problem solved. There is no information on wiki that LOVE reads first in archive, and only then in %APPDATA%, huh.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: Accessing LOVE archive files
Really? I went to the love.filesystem page on the wiki and the first lines says:Palmar wrote:There is no information on wiki that LOVE reads first in archive, and only then in %APPDATA%, huh.
Provides an interface to the user's filesystem.
This module provides access to files in two places, and two places only:
The root folder of the .love archive (or source directory)
The root folder of the game's save directory.
Later on it says:
... Pretty clear right?Files that are opened for read will be looked for in the save directory, and then in the .love archive (in that order). So if a file with a certain filename (and path) exist in both the .love archive and the save folder, the one in the save directory takes precedence.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
- slime
- Solid Snayke
- Posts: 3160
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Accessing LOVE archive files
You can change the behaviour with the optional second argument to [wiki]love.filesystem.setIdentity[/wiki], or by adding t.appendidentity = true to your love.conf function if you don't call love.filesystem.setIdentity.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest