Unix slashes in file path when using Mono

Bug report by MousePak
This commit is contained in:
ORelio 2014-06-27 13:26:27 +02:00
parent 2907b9c587
commit 608eb8059c
2 changed files with 10 additions and 9 deletions

View file

@ -33,14 +33,15 @@ namespace MinecraftClient.ChatBots
public static bool lookForScript(ref string filename) public static bool lookForScript(ref string filename)
{ {
//Automatically look in subfolders and try to add ".txt" file extension //Automatically look in subfolders and try to add ".txt" file extension
char dir_slash = Program.isUsingMono ? '/' : '\\';
string[] files = new string[] string[] files = new string[]
{ {
filename, filename,
filename + ".txt", filename + ".txt",
"scripts\\" + filename, "scripts" + dir_slash + filename,
"scripts\\" + filename + ".txt", "scripts" + dir_slash + filename + ".txt",
"config\\" + filename, "config" + dir_slash + filename,
"config\\" + filename + ".txt", "config" + dir_slash + filename + ".txt",
}; };
foreach (string possible_file in files) foreach (string possible_file in files)

View file

@ -100,7 +100,7 @@ namespace MinecraftClient.Protocol.Handlers
if (!System.IO.Directory.Exists("lang")) if (!System.IO.Directory.Exists("lang"))
System.IO.Directory.CreateDirectory("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? //File not found? Try downloading language file from Mojang's servers?
if (!System.IO.File.Exists(Language_File)) if (!System.IO.File.Exists(Language_File))