Skip to content

Commit

Permalink
Log OS version, catch more ControlledFolderAccess errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Jul 3, 2022
1 parent f81e172 commit 675bb38
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public class NPCDefinition : EntityDefinition
{
public static readonly Func<TagCompound, NPCDefinition> DESERIALIZER = Load;

// TODO: doesn't handle negative I think?
public override int Type => NPCID.Search.TryGetId(Mod != "Terraria" ? $"{Mod}/{Name}" : Name, out int id) ? id : -1;

public NPCDefinition() : base() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static void UpdateFolderShortcuts() {
// This is the first file system writing we attempt in the usual documents folder.
CreateLogsFolderShortcut();
}
catch (COMException) {
catch (Exception ex) when (ex is COMException || ex is FileNotFoundException) {
if (ControlledFolderAccessSupport.ControlledFolderAccessDetected) {
Utils.OpenToURL("https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Usage-FAQ#controlled-folder-access");
throw new Exception($"\n\nControlled Folder Access feature detected.\n\nIf game fails to launch make sure to add \"{Environment.ProcessPath}\" to the \"Allow an app through Controlled folder access\" menu found in the \"Ransomware protection\" menu.\n\nMore instructions can be found in the website that just opened.\n\n"); // Before language is loaded, no need to localize
Expand Down
2 changes: 1 addition & 1 deletion patches/tModLoader/Terraria/ModLoader/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal static void Init(LogFile logFile) {
internal static void LogStartup(bool dedServ) {
tML.InfoFormat("Starting tModLoader {0} {1} built {2}", dedServ ? "server" : "client", BuildInfo.BuildIdentifier, $"{BuildInfo.BuildDate:g}");
tML.InfoFormat("Log date: {0}", DateTime.Now.ToString("d"));
tML.InfoFormat("Running on {0} {1} {2} {3}", ReLogic.OS.Platform.Current.Type, System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture, FrameworkVersion.Framework, FrameworkVersion.Version);
tML.InfoFormat("Running on {0} (v{1}) {2} {3} {4}", ReLogic.OS.Platform.Current.Type, Environment.OSVersion.Version, System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture, FrameworkVersion.Framework, FrameworkVersion.Version);
tML.InfoFormat("Executable: {0}", Assembly.GetEntryAssembly().Location);
tML.InfoFormat("Working Directory: {0}", Path.GetFullPath(Directory.GetCurrentDirectory()));

Expand Down

0 comments on commit 675bb38

Please sign in to comment.