feat: Added methods for getting user data paths

This commit is contained in:
Chris Cameron
2020-04-14 16:13:13 -04:00
parent 79344a3667
commit 0d8dbf4a30

View File

@@ -358,6 +358,32 @@ namespace ICD.Common.Utils
return string.Format("Room{0}Data", roomId);
}
/// <summary>
/// Appends the local path to the user data path.
/// </summary>
/// <param name="userName"></param>
/// <param name="localPath"></param>
/// <returns></returns>
public static string GetUserDataPath(string userName, params string[] localPath)
{
if (localPath == null)
throw new ArgumentNullException("localPath");
string local = Join(localPath);
string userDataDirectory = GetUserDataDirectory(userName);
return Join(ProgramDataPath, userDataDirectory, local);
}
/// <summary>
/// Gets the directory name of the user data directory for the user with the given name.
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
public static string GetUserDataDirectory(string userName)
{
return string.Format("User{0}Data", StringUtils.RemoveWhitespace(userName));
}
/// <summary>
/// Appends the local path to the web server path.
/// </summary>