Here's my code:
Code: Select all
require("os")
function love.load()
fileName = "Test.txt"
saveDir = love.filesystem.getSaveDirectory( )
sourceDir = love.filesystem.getSourceBaseDirectory( )
oldPath = saveDir.."/"..fileName
newPath = sourceDir.."/"..fileName
end
function love.draw()
love.graphics.print(oldPath, 100, 100)
love.graphics.print(newPath, 100, 200)
end
os.rename(oldPath, newPath)
Code: Select all
Error
main.lua:17: bad argument #1 to 'rename' (string expected, got nil)
Traceback
[C]: in function 'rename'
main.lua:17: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Any idea what I'm doing wrong?