From 608eb8059c8b9b4da783b52406f312906f8ce280 Mon Sep 17 00:00:00 2001 From: ORelio Date: Fri, 27 Jun 2014 13:26:27 +0200 Subject: [PATCH] Unix slashes in file path when using Mono Bug report by MousePak --- MinecraftClient/ChatBots/Script.cs | 17 +++++++++-------- MinecraftClient/Protocol/Handlers/ChatParser.cs | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/MinecraftClient/ChatBots/Script.cs b/MinecraftClient/ChatBots/Script.cs index d8dbec96..63717fcc 100644 --- a/MinecraftClient/ChatBots/Script.cs +++ b/MinecraftClient/ChatBots/Script.cs @@ -33,15 +33,16 @@ namespace MinecraftClient.ChatBots public static bool lookForScript(ref string filename) { //Automatically look in subfolders and try to add ".txt" file extension + char dir_slash = Program.isUsingMono ? '/' : '\\'; string[] files = new string[] - { - filename, - filename + ".txt", - "scripts\\" + filename, - "scripts\\" + filename + ".txt", - "config\\" + filename, - "config\\" + filename + ".txt", - }; + { + filename, + filename + ".txt", + "scripts" + dir_slash + filename, + "scripts" + dir_slash + filename + ".txt", + "config" + dir_slash + filename, + "config" + dir_slash + filename + ".txt", + }; foreach (string possible_file in files) { diff --git a/MinecraftClient/Protocol/Handlers/ChatParser.cs b/MinecraftClient/Protocol/Handlers/ChatParser.cs index e6694528..df86f8a4 100644 --- a/MinecraftClient/Protocol/Handlers/ChatParser.cs +++ b/MinecraftClient/Protocol/Handlers/ChatParser.cs @@ -100,7 +100,7 @@ namespace MinecraftClient.Protocol.Handlers if (!System.IO.Directory.Exists("lang")) System.IO.Directory.CreateDirectory("lang"); - string Language_File = "lang\\" + Settings.Language + ".lang"; + string Language_File = "lang" + (Program.isUsingMono ? '/' : '\\') + Settings.Language + ".lang"; //File not found? Try downloading language file from Mojang's servers? if (!System.IO.File.Exists(Language_File))