From 1b1572ad85f16af61f297509aabde82dc90eab7c Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 31 Mar 2016 17:58:27 -0300 Subject: [PATCH] love.filesystem.mount accepts DroppedFiles in the first parameter. You could previously pass in DroppedFile:getFilename() and it would work too, this just makes it a bit nicer. --- src/modules/filesystem/wrap_Filesystem.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index 73bf874a1..0f9302c22 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -111,11 +111,20 @@ int w_getSource(lua_State *L) int w_mount(lua_State *L) { - const char *archive = luaL_checkstring(L, 1); + std::string archive; + + if (luax_istype(L, 1, FILESYSTEM_DROPPED_FILE_ID)) + { + DroppedFile *file = luax_totype(L, 1, FILESYSTEM_DROPPED_FILE_ID); + archive = file->getFilename(); + } + else + archive = luax_checkstring(L, 1); + const char *mountpoint = luaL_checkstring(L, 2); bool append = luax_optboolean(L, 3, false); - luax_pushboolean(L, instance()->mount(archive, mountpoint, append)); + luax_pushboolean(L, instance()->mount(archive.c_str(), mountpoint, append)); return 1; }