From 01530d637d790a101ea4dcb0e183664420d98ff9 Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Tue, 7 Mar 2017 13:14:07 +0000 Subject: [PATCH] Fix NPC generation --- ShiftOS.Objects/ShiftFS.cs | 5 ++++- ShiftOS.Server/RandomUserGenerator.cs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ShiftOS.Objects/ShiftFS.cs b/ShiftOS.Objects/ShiftFS.cs index e14c2a8..2c6b28b 100644 --- a/ShiftOS.Objects/ShiftFS.cs +++ b/ShiftOS.Objects/ShiftFS.cs @@ -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; diff --git a/ShiftOS.Server/RandomUserGenerator.cs b/ShiftOS.Server/RandomUserGenerator.cs index 8c1e430..672f25d 100644 --- a/ShiftOS.Server/RandomUserGenerator.cs +++ b/ShiftOS.Server/RandomUserGenerator.cs @@ -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); }