aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Kernel.cs
diff options
context:
space:
mode:
authorebr11 Eric Reed spam <ebr11 Eric Reed spam@reedsplace.com>2012-08-01 23:13:44 -0400
committerebr11 Eric Reed spam <ebr11 Eric Reed spam@reedsplace.com>2012-08-01 23:13:44 -0400
commit6e8bfb6d9b34e8aad876bdb21907ca686741e7cb (patch)
treef72c3e00a1c2c50ba5d1f013d885ff4baa5d0cd5 /MediaBrowser.Controller/Kernel.cs
parenta7bead51b2d3f84c0665e9559ca2d024b973c9e4 (diff)
Add ApplicationPaths class
Diffstat (limited to 'MediaBrowser.Controller/Kernel.cs')
-rw-r--r--MediaBrowser.Controller/Kernel.cs84
1 files changed, 44 insertions, 40 deletions
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");
+ // }
+ //}
/// <summary>
/// Gets the list of currently registered entity resolvers
@@ -434,22 +436,24 @@ namespace MediaBrowser.Controller
/// </summary>
private IEnumerable<User> 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<User> list = new List<User>();
- 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
/// <summary>
/// Gets a User from it's directory
/// </summary>
- 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<User>(file);
- }
+ // return JsonSerializer.DeserializeFromFile<User>(file);
+ //}
/// <summary>
/// Creates a User with a given name
/// </summary>
- 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;
+ //}
}
}