From e164d7a8bfa6a5efd26c557de307c2cfdb973ef8 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Sun, 10 Nov 2019 16:03:10 -0700 Subject: [PATCH 1/2] Change exception printing, and unset read-only during move. --- Wabbajack.Common/Utils.cs | 19 +------------------ Wabbajack.Lib/Installer.cs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Wabbajack.Common/Utils.cs b/Wabbajack.Common/Utils.cs index de12e992..ed87903d 100644 --- a/Wabbajack.Common/Utils.cs +++ b/Wabbajack.Common/Utils.cs @@ -497,24 +497,7 @@ namespace Wabbajack.Common public static string ExceptionToString(this Exception ex) { - var sb = new StringBuilder(); - while (ex != null) - { - sb.AppendLine(ex.Message); - var st = new StackTrace(ex, true); - foreach (var frame in st.GetFrames()) - sb.AppendLine( - $"{frame.GetFileName()}:{frame.GetMethod().Name}:{frame.GetFileLineNumber()}:{frame.GetFileColumnNumber()}"); - ex = ex.InnerException; - } - - - return sb.ToString(); - } - - public static void CrashDump(Exception e) - { - File.WriteAllText($"{DateTime.Now.ToString("yyyyMMddTHHmmss_crash_log.txt")}", ExceptionToString(e)); + return ex.ToString(); } public static IEnumerable DistinctBy(this IEnumerable vs, Func select) diff --git a/Wabbajack.Lib/Installer.cs b/Wabbajack.Lib/Installer.cs index e26b0d00..dd064675 100644 --- a/Wabbajack.Lib/Installer.cs +++ b/Wabbajack.Lib/Installer.cs @@ -400,7 +400,22 @@ namespace Wabbajack.Lib void CopyFile(string from, string to, bool use_move) { if (File.Exists(to)) + { + var fi = new FileInfo(to); + if (fi.IsReadOnly) + fi.IsReadOnly = false; File.Delete(to); + } + + if (File.Exists(from)) + { + var fi = new FileInfo(from); + if (fi.IsReadOnly) + fi.IsReadOnly = false; + File.Delete(from); + } + + if (use_move) File.Move(from, to); else From 3a66a35fe3f04877a71b8d099baeafbc2363e539 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Sun, 10 Nov 2019 16:21:51 -0700 Subject: [PATCH 2/2] fix in readonly changes --- Wabbajack.Lib/Installer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Wabbajack.Lib/Installer.cs b/Wabbajack.Lib/Installer.cs index dd064675..70d636bd 100644 --- a/Wabbajack.Lib/Installer.cs +++ b/Wabbajack.Lib/Installer.cs @@ -412,7 +412,6 @@ namespace Wabbajack.Lib var fi = new FileInfo(from); if (fi.IsReadOnly) fi.IsReadOnly = false; - File.Delete(from); }