public FullPath CalculateParentPath(FullPath currentPath, string relativePath) { string relativeNormalized = _system.Normalize(relativePath); string projectFolder = _system.GetDirectoryName(currentPath); string combined = _system.Combine(projectFolder, relativeNormalized); string full = _system.GetFullPath(combined); return(new FullPath(full)); }
private IEnumerable <ProjectContainer> ScanProject(string projectFilePath) { ProjectContainer project = LoadProjectFile(projectFilePath); yield return(project); string projectFolder = _fileIO.GetDirectoryName(projectFilePath); foreach (var module in project.Modules) { string modulePath = _fileIO.Combine(projectFolder, module.Path, "pom.xml"); if (_fileIO.IsFileExist(modulePath)) { var subModules = ScanProject(modulePath); foreach (var subModule in subModules) { yield return(subModule); } } } }
public IEnumerable <IExternalModule> Load(string baseDir) { var fileName = _fileIo.Combine(baseDir, ExternalModulesFileName); if (!_fileIo.IsFileExist(fileName)) { return(new IExternalModule[] {}); } var xdocument = XDocument.Load(fileName); var document = new ExternalModulesDocument(xdocument); // TODO: should be done via serializer return(document.ReadModules()); }
// REVIEW: loadDisconnectedProjects need to be rewired internal void Open(string fileOrFolderName, bool loadDisconnectedProjects) { if (fileOrFolderName == null) { throw new ArgumentNullException("fileOrFolderName"); } string fullPath = _fileIo.GetFullPath(fileOrFolderName); string filePath; if (_fileIo.IsFileExist(fullPath)) { BaseDir = _fileIo.GetDirectoryName(fullPath); filePath = fullPath; } else if (_fileIo.IsDirectoryExist(fullPath)) { BaseDir = fullPath; filePath = _fileIo.Combine(fullPath, ProjectTreeLoader.ProjectFilePattern); } else { throw new FileNotFoundException("Solution entry point is missing", fullPath); } if (loadDisconnectedProjects) { foreach (var project in _loader.ScanForProjects(BaseDir)) { Add(project); } } else { foreach (var project in _loader.LoadProjectTree(filePath)) { Add(project); } } foreach (var externalModule in _externalModulesLoader.Load(BaseDir)) { Add(externalModule); } }