command "os.execute" 在我的 premake lua 中不起作用

我正在制作一个 premake5.lua 文件,并且我需要将一个文件夹复制到另一个地方。当涉及到复制文件时,premake 给出一个命令 {COPY},在文档中他们提议使用 {COPYDIR},但它在 Windows 中并没有像他们在文档中说的那样起作用。所以我试着使用 os.execute,但仍然没有效果。我阅读了其他栈和许多互联网文章,但似乎在我的情况下没有任何东西能够起作用。这是因为它是一个 premake 配置文件,所以 lua 的“本地”函数在其中不起作用吗?

这是我的 premake5.lua

include "build/conanbuildinfo.premake.lua"

workspace "TileEditor"
    conan_basic_setup()

    configurations
    {
        "Debug",
        "Release",
        "Dist"
    }

outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"

project "TileEditor"
    location "TileEditor"
    kind "ConsoleApp"
    language "C++"

    targetdir ("bin/" .. outputdir .. "/%{prj.name}")
    objdir ("bin-obj/" .. outputdir .. "/%{prj.name}")

    linkoptions { conan_exelinkflags }

    files
    {
        "**.h", "**.cpp"
    }

    configuration "windows"
        postbuildcommands {
            "{COPY} ../build/bin/Qt6Core.dll %{cfg.targetdir}",
            "{COPY} ../build/bin/Qt6Gui.dll %{cfg.targetdir}",
            "{COPY} ../build/bin/Qt6Widgets.dll %{cfg.targetdir}",
            os.execute("mkdir %{cfg.targetdir}/platforms")
        }
点赞