2012-08-16 71 views

回答

1

下面是一個適用於我的代碼片段。

IList<FileSpec> filesToFind = new List<FileSpec>(); 
FileSpec fileToFind = new FileSpec(new DepotPath("//depot/....cpp"), null, null, VersionSpec.Head); 
filesToFind.Add(fileToFind); 
IList<FileSpec> filesFound = pRep.GetDepotFiles(filesToFind, null); 
+0

謝謝你的指針!這對我行得通。 – Kevin 2012-08-17 21:45:00

+0

當一個軟件倉庫路徑沒有文件時,我從pRep.GetDepotFiles(fileToFind,null)得到一個異常,而不是返回null。例外情況是:「未將對象引用設置爲對象的實例」。我錯過了什麼?謝謝。 – Kevin 2012-10-17 19:42:11

1

有關the docs的快速瀏覽並不會立即顯示任何內容,但您始終可以使用P4Command.Run來運行任意Perforce命令,因此您仍然可以運行p4 files //depot/...cpp

+0

如何從p4Command.Run獲得輸出以返回「p4 files ...」命令? – Kevin 2012-08-16 01:01:21

+1

我在回答中鏈接到的文檔中的介紹將爲您提供答案。 'P4CommandResult results = cmd.Run(opts);' – Mark 2012-08-16 01:17:30