From 6e8bfb6d9b34e8aad876bdb21907ca686741e7cb Mon Sep 17 00:00:00 2001 From: ebr11 Eric Reed spam Date: Wed, 1 Aug 2012 23:13:44 -0400 Subject: Add ApplicationPaths class --- MediaBrowser.Controller/Kernel.cs | 84 ++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 40 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index ca7fd382a..6d936f785 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Kernel; using MediaBrowser.Common.Serialization; using MediaBrowser.Controller.Configuration; @@ -34,17 +35,18 @@ namespace MediaBrowser.Controller { get { - return Path.Combine(ProgramDataPath, "Root"); + return ApplicationPaths.RootFolderPath; } } - private string UsersPath - { - get - { - return Path.Combine(ProgramDataPath, "Users"); - } - } + //gonna want to load this from the standard repository... -ebr + //private string UsersPath + //{ + // get + // { + // return Path.Combine(ProgramDataPath, "Users"); + // } + //} /// /// Gets the list of currently registered entity resolvers @@ -434,22 +436,24 @@ namespace MediaBrowser.Controller /// private IEnumerable GetAllUsers() { - if (!Directory.Exists(UsersPath)) - { - Directory.CreateDirectory(UsersPath); - } + //we'll get this from the standard repo... -ebr + + //if (!Directory.Exists(UsersPath)) + //{ + // Directory.CreateDirectory(UsersPath); + //} List list = new List(); - foreach (string folder in Directory.GetDirectories(UsersPath, "*", SearchOption.TopDirectoryOnly)) - { - User item = GetFromDirectory(folder); + //foreach (string folder in Directory.GetDirectories(UsersPath, "*", SearchOption.TopDirectoryOnly)) + //{ + // User item = GetFromDirectory(folder); - if (item != null) - { - list.Add(item); - } - } + // if (item != null) + // { + // list.Add(item); + // } + //} return list; } @@ -457,36 +461,36 @@ namespace MediaBrowser.Controller /// /// Gets a User from it's directory /// - private User GetFromDirectory(string path) - { - string file = Path.Combine(path, "user.js"); + //private User GetFromDirectory(string path) + //{ + // string file = Path.Combine(path, "user.js"); - return JsonSerializer.DeserializeFromFile(file); - } + // return JsonSerializer.DeserializeFromFile(file); + //} /// /// Creates a User with a given name /// - public User CreateUser(string name) - { - var now = DateTime.Now; + //public User CreateUser(string name) + //{ + // var now = DateTime.Now; - User user = new User() - { - Name = name, - Id = Guid.NewGuid(), - DateCreated = now, - DateModified = now - }; + // User user = new User() + // { + // Name = name, + // Id = Guid.NewGuid(), + // DateCreated = now, + // DateModified = now + // }; - user.Path = Path.Combine(UsersPath, user.Id.ToString()); + // user.Path = Path.Combine(UsersPath, user.Id.ToString()); - Directory.CreateDirectory(user.Path); + // Directory.CreateDirectory(user.Path); - JsonSerializer.SerializeToFile(user, Path.Combine(user.Path, "user.js")); + // JsonSerializer.SerializeToFile(user, Path.Combine(user.Path, "user.js")); - return user; - } + // return user; + //} } } -- cgit v1.2.3