public static UserConfig LoadConfig(bool isUnix) { if (isUnix) { PathToFile = Environment.GetEnvironmentVariable("HOME") + "/.config/imgdanke/"; if (!FileOps.DoesDirectoryExist(PathToFile)) { Directory.CreateDirectory(PathToFile); } PathToFile += CONFIG_FILENAME; } else if (!FileOps.DoesFileExist(PathToFile)) { // See if it's where it's being called from, which in most cases, will be next to the executable PathToFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); PathToFile ??= ""; PathToFile = Path.Combine(PathToFile, CONFIG_FILENAME); } UserConfig config = CreateOrDeserializeConfig(); config.Defaults(); if (config._validInputExtensions.Count == 0) { config._validInputExtensions = new List <string> { ".png", ".jpg", ".jpeg", ".psd", ".tif", ".gif", ".webp" }; } if (config._validOutputExtensions.Count == 0) { config._validOutputExtensions = new List <string> { ".png", ".jpg" }; } return(config); }