root dir is done

This commit is contained in:
kay.one 2011-07-01 13:59:25 -07:00
commit 94e16a6037
8 changed files with 25 additions and 134 deletions

View file

@ -55,7 +55,7 @@ namespace NzbDrone.Web.Controllers
Path = r.Path,
CleanPath = r.Path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^').Replace('\'', '`')
});
ViewData["RootDirs"] = rootDirs;
ViewData["RootDirs"] = rootDirs.ToList();
ViewData["DirSep"] = Path.DirectorySeparatorChar.ToString().Replace(Path.DirectorySeparatorChar, '|');
var defaultQuality = _configProvider.DefaultQualityProfile;
@ -88,11 +88,6 @@ namespace NzbDrone.Web.Controllers
}
public ActionResult Test()
{
return View();
}
public ActionResult AddExisting()
{
var rootDirs = _rootFolderProvider.GetAll();

View file

@ -32,6 +32,7 @@ namespace NzbDrone.Web.Controllers
[HttpGet]
public JsonResult GetDirectories(string q)
{
string[] dirs = null;
try
{
//Windows (Including UNC)
@ -39,18 +40,16 @@ namespace NzbDrone.Web.Controllers
if (windowsSep > -1)
{
var dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1));
return Json(dirs, JsonRequestBehavior.AllowGet);
dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1));
}
return Json(new string[] { }, JsonRequestBehavior.AllowGet);
//Unix
var index = q.LastIndexOf('/');
if (index > -1)
{
var dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1));
//return new SelectList(dirs, dirs.FirstOrDefault());
dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1));
}
}
catch
@ -58,7 +57,7 @@ namespace NzbDrone.Web.Controllers
//Swallow the exceptions so proper JSON is returned to the client (Empty results)
}
return Json(new string[]{}, JsonRequestBehavior.AllowGet);
return Json(dirs, JsonRequestBehavior.AllowGet);
}
}
}