2011-01-20 10 views
2

C#アプリケーション内の特定のディレクトリにあるビューの非公開リストを取得しようとしています。
私はその電話をかけるには、以下の機能を使用しています:コマンドプロンプトとC#アプリケーションの間でcleartoolが同じ動作をしない

ClearCommand = "ls -r -view_only" 

directory = @"E:\VobName\sampleDir". 

それが返されます。

cleartool: Error: Pathname is not within a VOB: "E:\VobName\Sampledir" 

私は、Windowsのコマンドプロンプトで同じコマンドを実行するとE:\VobName\sampleDirから、それは正常に動作します。
実行方法にこの不一致があるのはなぜですか?ここで


は、関連するコードです:

private String RunCommand(String clearCommand, String directory) 
    { 
     String retVal = String.Empty; 

     ProcessStartInfo startInfo = new ProcessStartInfo(); 
     startInfo.FileName = "cleartool"; 
     startInfo.Arguments = clearCommand; 
     startInfo.UseShellExecute = false; 
     startInfo.CreateNoWindow = true; 
     startInfo.RedirectStandardOutput = true; 
     startInfo.RedirectStandardError = true; 
     startInfo.WorkingDirectory = directory; 

     try 
     { 
      // Start the process with the info we specified. 
      // Call WaitForExit and then the using statement will close. 
      using (Process process = Process.Start(startInfo)) 
      { 
       //exeProcess.WaitForExit(); 

       // Read in all the text from the process with the StreamReader. 
       using (StreamReader reader = process.StandardOutput) 
       { 
        retVal = reader.ReadToEnd(); 
       } 

       if (String.IsNullOrEmpty(retVal)) 
       { 
        // Read in all the text from the process with the StreamReader. 
        using (StreamReader reader = process.StandardError) 
        { 
         retVal = reader.ReadToEnd(); 
        } 
       } 
      } 
     } 
     catch 
     { 
      Debug.Assert(false, "Error sending command"); 
     } 

     return retVal; 
    } 

答えて

0
E:\VobName\Sampledir 

は、ドライブ文字がパスに割り当てるです。 Windows command substを参照してください。
ビューの実際の完全パスを試しましたか?

(snapshot view) 
C:\path\to\myView\VobName\Sampledir 

か:

(dynamic view) 
M:\myView\VobName\Sampledir 
+0

元のコメントのパスは絶対パスです。私は静的ビュー専用のパーティション(E:\\)を持っています。 – JGoforth

+0

@JGoforth:いいえ、完全なパスではありません。スナップショットビューとは、「:\ aViewName \ aVobName \ someDirs」を意味します。 'VobName'をドライブ文字の直後に置くことは、' subst'が完了したことを意味します(例えば、ClearCaseエクスプローラを使って 'View shortcut'を使って) – VonC

関連する問題