@@ -8,7 +8,7 @@ class OpenFileField : FieldBase<string[]?>
88 public OpenFileField ( string ? customDefaultFileName , string ? customDefaultFolder ,
99 bool ? allowMultiple , bool isRequired , string description
1010 , string ? longName , string ? shortName , bool useEqualConnector ) : base (
11- new [ ] { Path . Join ( customDefaultFolder , customDefaultFileName ) }
11+ JoinPath ( customDefaultFolder , customDefaultFileName )
1212 , isRequired , longName , shortName , description , useEqualConnector )
1313 {
1414 CustomDefaultFileName = customDefaultFileName ;
@@ -21,5 +21,15 @@ public OpenFileField(string? customDefaultFileName, string? customDefaultFolder,
2121 public string ? CustomDefaultFileName { get ; init ; }
2222
2323 public override string ValueToString ( string [ ] ? value )
24- => string . Join ( ' ' , value ?? Array . Empty < string > ( ) ) ;
24+ => string . Join ( ' ' , ( value ?? Array . Empty < string > ( ) ) . Select ( Escape ) ) ;
25+
26+ private static string [ ] ? JoinPath ( string ? folder , string ? file )
27+ => ( folder , file ) switch
28+ {
29+ ( not null , not null ) => new [ ] { Path . Join ( folder , file ) } ,
30+ _ => null
31+ } ;
32+
33+ private static string Escape ( string s )
34+ => '\" ' + s . Replace ( "\" " , "\\ \" " ) + '\" ' ;
2535}
0 commit comments