fixed argument oder being incorrect corrupting project files

This commit is contained in:
Ell 2023-12-21 21:20:47 +01:00
parent 5897609dd2
commit 280d92edf3

View file

@ -20,8 +20,8 @@ public static class Program {
} }
var contentFile = new FileInfo(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, args[0]))); var contentFile = new FileInfo(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, args[0])));
if (!contentFile.Exists) { if (!contentFile.Exists || contentFile.Extension != ".mgcb") {
Console.Error.WriteLine($"Unable to find content file {contentFile}"); Console.Error.WriteLine($"Unable to find valid content file at {contentFile}");
return; return;
} }
@ -50,6 +50,10 @@ public static class Program {
if (config.References.Length > 0) { if (config.References.Length > 0) {
if (args.Length > 1) { if (args.Length > 1) {
var csprojFullPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, args[1])); var csprojFullPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, args[1]));
if (!File.Exists(csprojFullPath) || Path.GetExtension(csprojFullPath) != ".csproj") {
Console.Error.WriteLine($"Unable to find valid project file at {contentFile}");
return;
}
Program.ExtractVersions(csprojFullPath, referencesVersions); Program.ExtractVersions(csprojFullPath, referencesVersions);
var settings = Settings.LoadDefaultSettings(Path.GetDirectoryName(csprojFullPath)); var settings = Settings.LoadDefaultSettings(Path.GetDirectoryName(csprojFullPath));
packagesFolder = SettingsUtility.GetGlobalPackagesFolder(settings); packagesFolder = SettingsUtility.GetGlobalPackagesFolder(settings);