Source

love-mount / tests / basic-mount / main.lua

Full commit

function love.load()
	-- mount the archive
	love.filesystem.mount("test.zip")
	local found = false
	
	-- go through all files
	print("Top level files:")
	for k, file in ipairs(love.filesystem.enumerate("/")) do
		print("found file \"" .. file .. "\"")
		if file == "TextFile.txt" then
			found = true
		end
	end
	
	if not found then
		print("Mounting of archive somehow failed!")
		return love.event.quit()
	else
		print("The message from mounted archive: "..love.filesystem.read("TextFile.txt"))
	end

	print("Now I'm going to save some kittens by umounting that archive!")
	love.filesystem.umount("test.zip")
		
	-- go through all files
	print("Now let's confirm archive is no longer available")
	found = false
	print("Top level files:")
	for k, file in ipairs(love.filesystem.enumerate("/")) do
		print("found file \"" .. file .. "\"")
		if file == "TextFile.txt" then
			found = true
		end
	end
	
	if not found then
		print("Archive successfully umounted!")
	else
		print("Umounting of archive somehow failed! Message reads: "..love.filesystem.read("TextFile.txt"))
	end
	
	return love.event.quit()
end