2011-01-20 3 views
2

C# 응용 프로그램 내에서 특정 디렉터리의보기 개인 설정 목록을 가져 오려고합니다. 내가 가진 그 전화를 아래의 기능을 사용하고
:cleartool이 명령 프롬프트와 C# 응용 프로그램 사이에서 동일하게 작동하지 않습니다.

ClearCommand = "ls -r -view_only" 

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

그것은 반환 : 나는 창에 동일한 명령을 할 경우

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

은 명령 프롬프트 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

@JGorth : 아니요, 전체 경로가 아닙니다. 스냅 샷 뷰는 ' : \ aViewName \ aVobName \ someDirs'을 의미합니다. 'VobName'을 드라이브 문자 바로 다음에 올리려면 (예를 들어'보기 단축키 '를 가진 ClearCase Explorer를 통해)'subst'가 완료되었다는 것을 의미합니다. – VonC

관련 문제