diff options
| author | ruki <[email protected]> | 2025-06-10 00:51:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-06-10 00:51:25 +0800 |
| commit | 0504e8430a4d76ccda856087489d25085a863387 (patch) | |
| tree | 10da1728f47e1b91d81b7b1bd815f03a05da9193 | |
| parent | 773407f7df280a5fc50d2aa6419875297e711bb2 (diff) | |
translate file path for vsxmake
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vsutils.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/project/vsxmake/vsxmake.lua | 23 |
2 files changed, 14 insertions, 13 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vsutils.lua b/xmake/plugins/project/vstudio/impl/vsutils.lua index 9abf7a7b9..af184b536 100644 --- a/xmake/plugins/project/vstudio/impl/vsutils.lua +++ b/xmake/plugins/project/vstudio/impl/vsutils.lua @@ -52,3 +52,7 @@ function vsarch(arch) return arch end +-- translate file path (with namespace characters '::', it's invalid path characters on windows) +function translate_path(filepath) + return (filepath:gsub("::", "_")) +end diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua index d5cd5e078..67b7bd0d7 100644 --- a/xmake/plugins/project/vsxmake/vsxmake.lua +++ b/xmake/plugins/project/vsxmake/vsxmake.lua @@ -174,6 +174,7 @@ function _trycp(file, target, targetname) end function _writefileifneeded(file, content) + file = vsutils.translate_path(file) if os.isfile(file) and io.readfile(file) == content then dprint("skipped file %s since the file has the same content", path.relative(file)) return @@ -219,11 +220,7 @@ function make(version) end return function(outputdir) - - -- trace vprint("using project kind vs%d", version) - - -- check assert(version >= 2010, "vsxmake does not support vs version lower than 2010") -- get info and params @@ -240,20 +237,20 @@ function make(version) for _, target in ipairs(info.targets) do local paramsprovidertarget = _buildparams(info, target, "<!-- nil -->") - local proj_dir = info._targets[target].vcxprojdir + local vcxproj_dir = info._targets[target].vcxprojdir -- write project file - local proj = path.join(proj_dir, target .. ".vcxproj") - _writefileifneeded(proj, render(template_vcx, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) + local vcxproj_file = path.join(vcxproj_dir, target .. ".vcxproj") + _writefileifneeded(vcxproj_file, render(template_vcx, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) - local projfil = path.join(proj_dir, target .. ".vcxproj.filters") - _writefileifneeded(projfil, render(template_fil, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) + local vcxproj_filters = path.join(vcxproj_dir, target .. ".vcxproj.filters") + _writefileifneeded(vcxproj_filters, render(template_fil, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) -- add project custom file - _trycp(template_props, proj_dir) - _trycp(template_targets, proj_dir) - _trycp(template_items, proj_dir) - _trycp(template_itemfil, proj_dir) + _trycp(template_props, vcxproj_dir) + _trycp(template_targets, vcxproj_dir) + _trycp(template_items, vcxproj_dir) + _trycp(template_itemfil, vcxproj_dir) end -- clear config and local cache |
