]> git.lizzy.rs Git - minetest.git/blobdiff - builtin/mainmenu/common.lua
World config: Add modpack descriptions and remove dependencies there (#7397)
[minetest.git] / builtin / mainmenu / common.lua
index 7eb941775b9b67fc86fe4aeb365ba78402a2f9b1..cc61fe0adfc1e68c40d13f2132d1be015ee3ccfd 100644 (file)
@@ -41,7 +41,7 @@ local function render_client_count(n)
 end
 
 local function configure_selected_world_params(idx)
-       local worldconfig = modmgr.get_worldconfig(menudata.worldlist:get_list()[idx].path)
+       local worldconfig = pkgmgr.get_worldconfig(menudata.worldlist:get_list()[idx].path)
        if worldconfig.creative_mode then
                core.settings:set("creative_mode", worldconfig.creative_mode)
        end
@@ -171,15 +171,27 @@ os.tempfolder = function()
        local filetocheck = os.tmpname()
        os.remove(filetocheck)
 
-       local randname = "MTTempModFolder_" .. math.random(0,10000)
-       if DIR_DELIM == "\\" then
+       -- https://blogs.msdn.microsoft.com/vcblog/2014/06/18/c-runtime-crt-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1/
+       --   The C runtime (CRT) function called by os.tmpname is tmpnam.
+       --   Microsofts tmpnam implementation in older CRT / MSVC releases is defective.
+       --   tmpnam return values starting with a backslash characterize this behavior.
+       -- https://sourceforge.net/p/mingw-w64/bugs/555/
+       --   MinGW tmpnam implementation is forwarded to the CRT directly.
+       -- https://sourceforge.net/p/mingw-w64/discussion/723797/thread/55520785/
+       --   MinGW links to an older CRT release (msvcrt.dll).
+       --   Due to legal concerns MinGW will never use a newer CRT.
+       --
+       --   Make use of TEMP to compose the temporary filename if an old
+       --   style tmpnam return value is detected.
+       if filetocheck:sub(1, 1) == "\\" then
                local tempfolder = os.getenv("TEMP")
                return tempfolder .. filetocheck
-       else
-               local backstring = filetocheck:reverse()
-               return filetocheck:sub(0,filetocheck:len()-backstring:find(DIR_DELIM)+1) ..randname
        end
 
+       local randname = "MTTempModFolder_" .. math.random(0,10000)
+       local backstring = filetocheck:reverse()
+       return filetocheck:sub(0, filetocheck:len() - backstring:find(DIR_DELIM) + 1) ..
+               randname
 end
 
 --------------------------------------------------------------------------------