[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to detect spaces in paths
From: |
David Boyce |
Subject: |
Re: How to detect spaces in paths |
Date: |
Wed, 15 Dec 2021 08:49:57 -0800 |
Should handle empty vars:
$(if $(filter-out 1,$(words "$(PATH_TO_CHECK)")),$(error spaces found))
On Wed, Dec 15, 2021 at 7:14 AM Paul Smith <psmith@gnu.org> wrote:
> On Wed, 2021-12-15 at 15:05 +0100, R. Diez wrote:
> > Is there a better way?
>
> I think if $(words $(PATH_TO_CHECK)) is 1, then it's OK and if it's >1
> then it contains whitespace.
>
> You can write a test using $(if ...) rather than using ifeq, then it
> can be put anywhere:
>
> $(if $(filter-out 1,$(words $(PATH_TO_CHECK))),$(error spaces found))
>
> Just to note this will also say "spaces found" if the variable is
> empty... you'll have to check that separately if it's something to be
> concerned about.
>
>
>