public static string GetProjectFileRelativeToSolutionDirectoryPath(string solutionFilePath, string projectFilePath) { var solutionDirectoryPath = PathUtilities.GetDirectoryPath(solutionFilePath); var solutionDirectoryToDependencyProjectRelativeFilePath = PathUtilities.GetRelativePathDirectoryToFile(solutionDirectoryPath, projectFilePath); return(solutionDirectoryToDependencyProjectRelativeFilePath); }
/// <summary> /// Get the file path relative to the project directory of the specified project file path for the specified file path. /// Useful in determining /// </summary> public static string GetProjectDirectoryRelativeFilePath(string projectFilePath, string filePath) { var projectDirectoryPath = PathUtilities.GetDirectoryPath(projectFilePath); var relativeFilePath = PathUtilities.GetRelativePathDirectoryToFile(projectDirectoryPath, filePath); return(relativeFilePath); }
public static ProjectName GetProjectName(ProjectFilePath projectFilePath) { var projectFileName = PathUtilities.GetFileName(projectFilePath).AsProjectFileName(); var projectName = Utilities.GetProjectName(projectFileName); return(projectName); }
public static string GetUnresolvedPathAndResolve(string sourcePath, string relativePath, Func <string, string> pathResolver) { var unresolvedPath = PathUtilities.GetUnresolvedPath(sourcePath, relativePath); var resolvedPath = pathResolver(unresolvedPath); return(resolvedPath); }
public static IEnumerable <string> GetProjectReferenceDependencyFilePaths(this ProjectFileModel projectFileModel, string projectFilePath) { var projectDirectoryPath = PathUtilities.GetDirectoryPath(projectFilePath); var output = projectFileModel.GetProjectReferenceDependencyFilePathsForProjectDirectory(projectDirectoryPath); return(output); }
public static SolutionName GetSolutionName(SolutionFilePath solutionFilePath) { var solutionFileName = PathUtilities.GetFileName(solutionFilePath).AsSolutionFileName(); var projectName = Utilities.GetSolutionName(solutionFileName); return(projectName); }
public void DirectoryToFileInDirectoryRelativePathWindowsUri() { var sourceFilePath = PathValues.WindowsDirectoryPath1Unindicated; var destinationFilePath = PathValues.WindowsFilePath4; var expected = RelativePathValues.WindowsDirectoryPath1ToWindowsFilePath4Uri; var relativePath = PathUtilities.GetRelativePathUsingUriMakeRelativeUri(sourceFilePath, destinationFilePath); Assert.AreEqual(expected, relativePath); }
/// <summary> /// The project reference relative file paths are relative to the project directory, not file path. /// </summary> public static IEnumerable <string> GetProjectReferenceDependencyFilePathsForProjectDirectory(string projectDirectoryPath, IEnumerable <string> projectReferenceRelativeFilePaths) { foreach (var projectReferenceRelativeFilePath in projectReferenceRelativeFilePaths) { var projectFileUnresolvedPath = PathUtilities.Combine(projectDirectoryPath, projectReferenceRelativeFilePath); var projectFilePath = PathUtilities.ResolveFilePath(projectFileUnresolvedPath); yield return(projectFilePath); } }
public static IEnumerable <string> GetProjectReferenceDependencyFilePaths(ProjectFileModel projectFile, string projectFilePath) { var projectDirectoryPath = PathUtilities.GetDirectoryPath(projectFilePath); var projectReferenceRelativeFilePaths = projectFile.GetProjectReferenceRelativePaths(); var projectReferenceDependencyFilePaths = Utilities.GetProjectReferenceDependencyFilePathsForProjectDirectory(projectDirectoryPath, projectReferenceRelativeFilePaths); return(projectReferenceDependencyFilePaths); }
public static string GetProjectFilePath(string solutionFilePath, string projectRelativeToSolutionDirectoryFilePath) { var solutionDirectoryPath = PathUtilities.GetDirectoryPath(solutionFilePath); var projectFileUnresolvedPath = PathUtilities.Combine(solutionDirectoryPath, projectRelativeToSolutionDirectoryFilePath); var projectFilePath = PathUtilities.ResolveFilePath(projectFileUnresolvedPath); return(projectFilePath); }
public string GetGitHubAccountDirectoryPath(string solutionFilePath) { var solutionDirectoryPath = PathUtilities.GetDirectoryPath(solutionFilePath); var sourceDirectoryPath = PathUtilities.GetParentDirectoryPath(solutionFilePath); var repositoryDirectoryPath = PathUtilities.GetParentDirectoryPath(sourceDirectoryPath); var gitHubAccountDirectoryPath = PathUtilities.GetParentDirectoryPath(repositoryDirectoryPath); return(gitHubAccountDirectoryPath); }
public void FileToFileSameDirectoryRelativePathWindowsUri() { var sourceFilePath = PathValues.WindowsFilePath1; var destinationFilePath = PathValues.WindowsFilePath2; var expected = RelativePathValues.WindowsFilePath1ToWindowsFilePath2Uri; var relativePath = PathUtilities.GetRelativePathUsingUriMakeRelativeUri(sourceFilePath, destinationFilePath); Assert.AreEqual(expected, relativePath); }
public string GetLibraryProjectFilePath(string gitHubAccountDirectoryPath, string libraryName) { var repositoryDirectoryName = libraryName; var sourceDirectoryName = @"source"; var libraryProjectDirectoryName = libraryName; var libraryProjectFileName = $"{libraryName}.csproj"; var libraryProjectFilePath = PathUtilities.CombineWindows(gitHubAccountDirectoryPath, repositoryDirectoryName, sourceDirectoryName, libraryProjectDirectoryName, libraryProjectFileName); return(libraryProjectFilePath); }
public string GetSolutionFilePath(string currentExecutableFilePath, string solutionFileName) { var binDebugNetCoreAppDirectoryPath = PathUtilities.GetDirectoryPath(currentExecutableFilePath); var binDebugDirectoryPath = PathUtilities.GetParentDirectoryPath(binDebugNetCoreAppDirectoryPath); var binDirectoryPath = PathUtilities.GetParentDirectoryPath(binDebugDirectoryPath); var projectDirectoryPath = PathUtilities.GetParentDirectoryPath(binDirectoryPath); var solutionDirectoryPath = PathUtilities.GetParentDirectoryPath(projectDirectoryPath); var solutionFilePath = PathUtilities.Combine(solutionDirectoryPath, solutionFileName); return(solutionFilePath); }
/// <summary> /// Creates a directory, creating all required intermediate directories. /// Ok if the directory already exists (idempotent) like <see cref="CreateDirectoryOkIfExists(SftpClient, string)"/>. /// </summary> /// <remarks> /// The <see cref="Renci.SshNet.SftpClient.CreateDirectory(string)"/> method will not make intermediate directories for nested directories. For example, if A exists, but B does not, a call to create C such that /A/B/C will fail with exception: /// Renci.SshNet.Common.SftpPathNotFoundException: 'No such file' /// </remarks> public static void CreateDirectoryOkIfIntermediatesAndExists(this SftpClient sftpClient, string directoryPath) { // The SftpClient.CreateDirectory() call will not make intermediate directories as required for a path. // This work-around walks up the directory tree until a parent directory exists, and makes intermediate directories as required. var parentDirectoryPath = PathUtilities.GetParentDirectoryPath(directoryPath); if (!sftpClient.Exists(parentDirectoryPath)) { sftpClient.CreateDirectoryOkIfIntermediatesAndExists(parentDirectoryPath); } sftpClient.CreateDirectoryOkIfExists(directoryPath); }
public string ResolveDirectoryPath(string unresolvedDirectoryPath) { var resolvedDirectoryPath = PathUtilities.ResolveDirectoryPath(unresolvedDirectoryPath); return(resolvedDirectoryPath); }
public static SolutionName GetSolutionName(SolutionFileName solutionFileName) { var solutionName = PathUtilities.GetFileNameWithoutExtension(solutionFileName).Value.AsSolutionName(); return(solutionName); }
public static ProjectName GetProjectName(ProjectFileName projectFileName) { var projectName = PathUtilities.GetFileNameWithoutExtension(projectFileName).Value.AsProjectName(); return(projectName); }
public static string GetProjectName(string projectFilePath) { var projectName = PathUtilities.GetFileNameWithoutExtension(projectFilePath); return(projectName); }
public string ResolvePath(string unresolvedPath) { var resolvedPath = PathUtilities.ResolvePathUsingUriLocalPath(unresolvedPath); return(resolvedPath); }
public string GetRelativePathFileToDirectory(string sourceFilePath, string destinationFilePath) { var relativePath = PathUtilities.GetRelativePath(sourceFilePath, destinationFilePath); return(relativePath); }
public string ResolvePath(string unresolvedPath) { var resolvedPath = PathUtilities.ResolvePathUsingCustomLogic(unresolvedPath); return(resolvedPath); }
public string GetRelativePath(string sourcePath, string destinationPath) { var relativePath = PathUtilities.GetRelativePath(sourcePath, destinationPath); return(relativePath); }