public static void Write(string data, string fileName) { lock (logSync) { FileUtils.CreateDirIfNotExists(fileName); bool fileInUse = true; while (fileInUse) { try { using (StreamWriter log = File.AppendText(fileName)) { log.WriteLine(data); } fileInUse = false; } catch (System.IO.IOException) { fileInUse = true; } } } }
Settings() { FileUtils.CreateDirIfNotExists(DataPath); }