[Solved]love.filesystem problems...
Posted: Sat Jan 22, 2011 5:53 pm
Hello,
I'm new to the forums, although I've used Love a bit before (It's been a while, my Lua skills are pretty rusty). But I'm developing a game where I want to create a folder in the user's documents directory for placing files that the user can load and play in the game. So, I'm checking to see if the directory exists when the game starts up, and if it doesn't, I'm going to create it. When creating the directory, love.filesystem.mkdir returned false. So I decided to also attempt to write to my conf.lua file to see if that worked, and I got an error saying the write directory couldn't be set. Here's my code so far. Here's the code.
I tried running the program as an administrator with similar results... Any ideas?
I'm new to the forums, although I've used Love a bit before (It's been a while, my Lua skills are pretty rusty). But I'm developing a game where I want to create a folder in the user's documents directory for placing files that the user can load and play in the game. So, I'm checking to see if the directory exists when the game starts up, and if it doesn't, I'm going to create it. When creating the directory, love.filesystem.mkdir returned false. So I decided to also attempt to write to my conf.lua file to see if that worked, and I got an error saying the write directory couldn't be set. Here's my code so far. Here's the code.
Code: Select all
function love.load()
-- Creates the songs directory if it doesn't exist
sdir = love.filesystem.getUserDirectory() .. "SortMania 2 Songs"
print(sdir)
if (not love.filesystem.exists(sdir)) then
print("Directory doesn't exist... Attempting to create:")
print(love.filesystem.mkdir(sdir))
end
file = love.filesystem.newFile("conf.lua")
file:open("a")
file:write("-- Hello.")
-- Create the physics world
world = love.physics.newWorld(-2000,-2000,2000, 2000)
world:setGravity(0, 50)
end
function love.update(dt)
-- Update the world.
world:update(dt)
end