diff --git a/OpenDreamRuntime/Procs/Native/DreamProcNativeSavefile.cs b/OpenDreamRuntime/Procs/Native/DreamProcNativeSavefile.cs index 77b61b2570..06fdcce468 100644 --- a/OpenDreamRuntime/Procs/Native/DreamProcNativeSavefile.cs +++ b/OpenDreamRuntime/Procs/Native/DreamProcNativeSavefile.cs @@ -88,7 +88,8 @@ public static DreamValue NativeProc_ImportText(NativeProc.Bundle bundle, DreamOb private static string ExportTextInternal(DreamObjectSavefile savefile, int indent = 0) { string result = ""; var value = savefile.CurrentDir; - var key = savefile.CurrentPath; + var oldPath = savefile.CurrentPath; + var key = savefile.CurrentPath.Split('/').Last(); switch(value) { case DreamObjectSavefile.DreamPrimitive primitiveValue: if(primitiveValue.Value.IsNull) @@ -112,6 +113,8 @@ private static string ExportTextInternal(DreamObjectSavefile savefile, int inden //result += $"encoding=base64\",{{\"{Convert.ToBase64String(fileValue.Data)}\"}}"; result += ")\n"; break; + case DreamObjectSavefile.DreamObjectValue objectValue: + throw new NotImplementedException($"ExportText() can't do objects yet TODO"); case DreamObjectSavefile.DreamJsonValue jsonValue: result += $"{new string('\t', indent)}{key}\n"; break; @@ -125,7 +128,7 @@ private static string ExportTextInternal(DreamObjectSavefile savefile, int inden savefile.CurrentPath = subkey; result += ExportTextInternal(savefile, indent + 1); } - savefile.CurrentPath = key; + savefile.CurrentPath = oldPath; return result;