1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

lib.gvariant: escape backslashes in strings

PR #1433
This commit is contained in:
Symphorien Gibol 2020-08-08 12:00:00 +00:00 committed by Robert Helgesson
parent d1f4d1514d
commit e1fbb74b41
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 3 additions and 1 deletions

View file

@ -123,7 +123,7 @@ in rec {
mkString = v: mkString = v:
mkPrimitive type.string v // { mkPrimitive type.string v // {
__toString = self: "'${escape [ "'" ] self.value}'"; __toString = self: "'${escape [ "'" "\\" ] self.value}'";
}; };
mkObjectpath = v: mkObjectpath = v:

View file

@ -26,6 +26,7 @@ in {
{ string = "foo"; } { string = "foo"; }
{ string = "foo"; } { string = "foo"; }
{ escapedString = "' \\"; }
{ tuple = mkTuple [ 1 [ "foo" ] ]; } { tuple = mkTuple [ 1 [ "foo" ] ]; }
@ -46,6 +47,7 @@ in {
bool = true bool = true
emptyArray1 = @as [] emptyArray1 = @as []
emptyArray2 = @as [] emptyArray2 = @as []
escapedString = '\' \\'
float = 3.140000 float = 3.140000
int = 42 int = 42
list = @as ['one','two'] list = @as ['one','two']