Available since LÖVE 0.9.0
This function is not supported in earlier versions.
Returns the full path to the directory containing the .love file. If the game is fused to the LÖVE executable, then the directory containing the executable is returned.
If love.filesystem.isFused is true, the path returned by this function can be passed to love.filesystem.mount, which will make the directory containing the main game (e.g. C:\Program Files\coolgame\
) readable by love.filesystem.
path = love.filesystem.getSourceBaseDirectory( )
None.
string path
if love.filesystem.isFused() then local dir = love.filesystem.getSourceBaseDirectory() local success = love.filesystem.mount(dir, "coolgame") if success then -- If the game is fused and it's located in C:\Program Files\mycoolgame\, -- then we can now load files from that path. coolimage = love.graphics.newImage("coolgame/coolimage.png") end end function love.draw() if coolimage then love.graphics.draw(coolimage, 0, 0) end end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.filesystem.getSourceBaseDirectory