mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Android: Fix error when trying to open .love file through "Load .love File".
This commit is contained in:
@@ -284,14 +284,14 @@ bool Filesystem::setSource(const char *source)
|
||||
if (!isAAssetMounted)
|
||||
{
|
||||
// Is this love2d://fd/ URIs?
|
||||
int fd = love::android::getFDFromLoveProtocol(new_search_path.c_str());
|
||||
int fd = love::android::getFDFromLoveProtocol(source);
|
||||
if (fd != -1)
|
||||
{
|
||||
PHYSFS_Io *io = (PHYSFS_Io *) love::android::getIOFromFD(fd);
|
||||
|
||||
if (PHYSFS_mountIo(io, "LOVE.FD", nullptr, 0))
|
||||
{
|
||||
gameSource = new_search_path;
|
||||
gameSource = source;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,18 +87,23 @@ function love.boot()
|
||||
local identity = ""
|
||||
if not can_has_game and o.game.set and o.game.arg[1] then
|
||||
local nouri = o.game.arg[1]
|
||||
local full_source = nouri
|
||||
|
||||
if nouri:sub(1, 7) == "file://" then
|
||||
nouri = uridecode(nouri:sub(8))
|
||||
end
|
||||
-- Ignore "love2d://" uri as it's used to open a file-descriptor
|
||||
-- directly for Android.
|
||||
if nouri:sub(1, 9) ~= "love2d://" then
|
||||
if nouri:sub(1, 7) == "file://" then
|
||||
nouri = uridecode(nouri:sub(8))
|
||||
end
|
||||
|
||||
local full_source = love.path.getFull(nouri)
|
||||
local source_leaf = love.path.leaf(full_source)
|
||||
full_source = love.path.getFull(nouri)
|
||||
local source_leaf = love.path.leaf(full_source)
|
||||
|
||||
if source_leaf:match("%.lua$") then
|
||||
main_file = source_leaf
|
||||
custom_main_file = true
|
||||
full_source = love.path.getFull(full_source:sub(1, -(#source_leaf + 1)))
|
||||
if source_leaf:match("%.lua$") then
|
||||
main_file = source_leaf
|
||||
custom_main_file = true
|
||||
full_source = love.path.getFull(full_source:sub(1, -(#source_leaf + 1)))
|
||||
end
|
||||
end
|
||||
|
||||
can_has_game = pcall(love.filesystem.setSource, full_source)
|
||||
|
||||
Reference in New Issue
Block a user