Module: tools Branch: master Commit: 73bd7f01fbefb1d29b32560b6bc52e55e4c38d6f URL: https://source.winehq.org/git/tools.git/?a=commit;h=73bd7f01fbefb1d29b32560b...
Author: Francois Gouget fgouget@codeweavers.com Date: Tue Dec 21 16:38:29 2021 +0100
testbot/SetWinLocale: Accept underscores in the locale names.
Also avoid undefined value errors if the locale value is missing.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/bin/SetWinLocale | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index 7ddbded..4ecc0cb 100755 --- a/testbot/bin/SetWinLocale +++ b/testbot/bin/SetWinLocale @@ -279,14 +279,16 @@ sub CheckValue($$) sub CheckLocale($$) { my ($Option, $Value) = @_; + $Value = CheckValue($Option, $Value); - if ($Value !~ /^(?:[a-z]{2})-(?:Latn-)?(?:[A-Z]{2})$/) - { - Error("'$Value' is not a valid $Option locale\n"); - $Usage = 2; - return undef; - } - return $Value; + return undef if (!defined $Value); + + $Value =~ s/_/-/g; + return $Value if ($Value =~ /^(?:[a-z]{2})-(?:Latn-)?(?:[A-Z]{2})$/); + + Error("'$Value' is not a valid $Option locale\n"); + $Usage = 2; + return undef; }
my ($OptHostName, $OptReboot);