1
string f = "C:\Test@1234.txt"
cmd = new P4Command(p4, "add", true, "-c", changelist.Id.ToString(), f);

当我的文件名包含“@”这个字符时,它会记录错误异常:

add file get this Can't add filenames with wildcards [@#%*] in them

我如何解决这个问题,我使用 p4api.net。

4

1 回答 1

2

从命令行,您可以传递-f标志以强制添加带有通配符的文件:

C:\Perforce\test\chars>p4 add -n foo@bar
The file named 'foo@bar' contains wildcards [@#%*].
Can't add filenames with wildcards [@#%*] in them.
Use -f option to force add.

C:\Perforce\test\chars>p4 add -n -f foo@bar
//stream/main/chars/foo%40bar#1 - opened for add

看起来P4Command您只需将服务器命令(及其参数)传递给构造函数,因此您应该能够:

new P4Command(p4, "add", true, "-c", changelist.Id.ToString(), "-f", f);
于 2019-12-27T08:52:19.980 回答