From 0d8dbf4a306363449e9781ff328eba615a9b02e3 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Tue, 14 Apr 2020 16:13:13 -0400 Subject: [PATCH] feat: Added methods for getting user data paths --- ICD.Common.Utils/PathUtils.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ICD.Common.Utils/PathUtils.cs b/ICD.Common.Utils/PathUtils.cs index bdc6495..2e3a89f 100644 --- a/ICD.Common.Utils/PathUtils.cs +++ b/ICD.Common.Utils/PathUtils.cs @@ -358,6 +358,32 @@ namespace ICD.Common.Utils return string.Format("Room{0}Data", roomId); } + /// + /// Appends the local path to the user data path. + /// + /// + /// + /// + 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); + } + + /// + /// Gets the directory name of the user data directory for the user with the given name. + /// + /// + /// + public static string GetUserDataDirectory(string userName) + { + return string.Format("User{0}Data", StringUtils.RemoveWhitespace(userName)); + } + /// /// Appends the local path to the web server path. ///