コード例 #1
0
ファイル: Instance.cs プロジェクト: radius314/gitdeployhub
 public Instance(Hub hub, string name, string treeish = null, string folder = null)
 {
     Hub = hub;
     Name = name;
     Treeish = treeish;
     Folder = folder;
     EnvironmentVariables = new Dictionary<string, string>();
     if (string.IsNullOrWhiteSpace(Folder))
     {
         if (Name == "_self")
         {
             Folder = Path.GetFullPath(MappedApplicationPath);
             if (!HasFile(".git"))
             {
                 var gitFolder = Folder;
                 while (!string.IsNullOrEmpty(gitFolder))
                 {
                     gitFolder = Directory.GetParent(gitFolder).FullName;
                     if (Directory.Exists(Path.Combine(gitFolder, ".git")))
                     {
                         Folder = gitFolder;
                         break;
                     }
                 }
             }
         }
         else
         {
             Folder = Path.GetFullPath(Path.Combine(MappedApplicationPath, Path.Combine("../../", name)));
         }
     }
 }