Skip to content

Conversation

@nickclark2016
Copy link
Member

What does this PR do?

Resolves #2426 - Escapes run paths with spaces using quotes

How does this PR change Premake's behavior?

No breaking changes

Anything else we should know?

N/A

Did you check all the boxes?

  • Focus on a single fix or feature; remove any unrelated formatting or code changes
  • Add unit tests showing fix or feature works; all tests pass
  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • Follow our coding conventions
  • Minimize the number of commits
  • Align documentation to your changes

You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!

@nickclark2016 nickclark2016 requested review from a team February 20, 2025 21:32

for _, fullpath in ipairs(dirs) do
local rpath = path.getrelative(cfg.buildtarget.directory, fullpath)
rpath = p.quoted(rpath) -- quote in case of spaces in path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In "linker" mode, it is already surround (unconditionally) by '

Copy link
Member

@samsinsane samsinsane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some unit tests for this?

@perseoGI
Copy link

Is there any progress with this, @nickclark2016?
This PR came to light as a result of this discussion utelle/wxsqlite3#129 (comment).

Remember me from #2441 (better Conan support).

If, for some reason, you declare a Premake project configuration with white spaces, e.g.

    configurations { "Debug", "Release", "Debug Sanitizers", "Release Sanitizers" }

Compiling with the gmake generator, having a white space will force Makefile to create two incorrect directories instead of one. See my comment here.

@utelle shared with me a working (but probably not universal) solution to handle this case:

premake.override(premake.modules.gmake, "target", function(base, cfg, toolset)
  local targetpath = string.gsub(premake.project.getrelative(cfg.project, cfg.buildtarget.directory), ' ', '_')
  premake.outln('TARGETDIR = ' .. targetpath)
  premake.outln('TARGET = $(TARGETDIR)/' .. cfg.buildtarget.name)
end)
  
premake.override(premake.modules.gmake, "objdir", function(base, cfg, toolset)
  local objpath = string.gsub(premake.project.getrelative(cfg.project, cfg.objdir), ' ', '_')
  premake.outln('OBJDIR = ' .. objpath)
end)

Could you consider addressing this issue?
Thank you very much in advance! 🐸

@nickclark2016
Copy link
Member Author

Honestly, I'm extremely busy right now with work. The soonest I'll be able to get to new development on Premake is the new year. I'll happily review any PRs that get put out for this, but this one is probably dead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated Makefiles break on linux when there are space(s) in the directory path

4 participants