Skip to content

Commit d7408f4

Browse files
committed
Fix -world flag
When paired with -autocreate, game.SetWorld now throws a FileNotFoundException, making the autocreate flag not work.
1 parent 647fd60 commit d7408f4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

TerrariaServerAPI/TerrariaApi.Server/ServerApi.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,15 @@ internal static void HandleCommandLine(string[] parms)
202202
}
203203
case "-world":
204204
{
205-
game.SetWorld(arg.Value, false);
205+
if (File.Exists(arg.Value))
206+
{
207+
game.SetWorld(arg.Value, false);
208+
}
209+
else
210+
{
211+
Main.autoGenFileLocation = arg.Value;
212+
Main.ActiveWorldFileData = new Terraria.IO.WorldFileData(arg.Value, false);
213+
}
206214

207215
var full_path = Path.GetFullPath(arg.Value);
208216
Main.WorldPath = Path.GetDirectoryName(full_path);

0 commit comments

Comments
 (0)