Sicherung

This commit is contained in:
maier_S
2022-03-24 15:52:02 +01:00
parent c9c8a7bcd0
commit bea46135fd
228 changed files with 75756 additions and 118 deletions

View File

@@ -0,0 +1,44 @@
using System;
using System.IO;
namespace FSI.Lib.CompareNetObjects
{
/// <summary>
/// Helper methods for files and directories
/// </summary>
public static class FileHelper
{
/// <summary>
/// Get the current directory of the executing assembly
/// </summary>
/// <returns></returns>
public static string GetCurrentDirectory()
{
#if NETSTANDARD
string basePath = AppContext.BaseDirectory;
#else
string basePath = AppDomain.CurrentDomain.BaseDirectory;
#endif
return PathSlash(basePath);
}
/// <summary>
/// Ensure the passed string ends with a directory separator character unless the string is blank.
/// </summary>
/// <param name="path">The string to append the backslash to.</param>
/// <returns>String with a "/" on the end</returns>
public static String PathSlash(string path)
{
string separator = Convert.ToString(Path.DirectorySeparatorChar);
if (path.Length == 0)
return path;
else if (path.EndsWith(separator))
return path;
else
return path + separator;
}
}
}