Fix NPC generation

This commit is contained in:
Michael VanOverbeek 2017-03-07 13:14:07 +00:00
parent bf3dbc26a5
commit 01530d637d
2 changed files with 6 additions and 2 deletions

View file

@ -291,10 +291,13 @@ namespace ShiftOS.Objects.ShiftFS
{
string[] pathlist = path.Split('/');
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
if (Mounts[vol] == null)
Mounts[vol] = new Directory();
var dir = Mounts[vol];
for (int i = 1; i <= pathlist.Length - 1; i++)
{
dir = dir.FindDirectoryByName(pathlist[i]);
dir = dir?.FindDirectoryByName(pathlist[i]);
}
return dir != null;

View file

@ -119,6 +119,7 @@ namespace ShiftOS.Server
var dir = new ShiftOS.Objects.ShiftFS.Directory();
//name the directory after the user
dir.Name = sve.Username;
dir.permissions = Objects.ShiftFS.Permissions.All;
//json the object and mount
string json = Newtonsoft.Json.JsonConvert.SerializeObject(dir);
//mount it to the MUD
@ -219,7 +220,7 @@ namespace ShiftOS.Server
string sDir = dir.Replace("\\", "/");
if (sDir.Contains("shiftnet"))
{
while (!sDir.StartsWith("shiftnet/"))
while (!sDir.StartsWith("shiftnet"))
{
sDir = sDir.Remove(0, 1);
}