diff --git a/XmlSchemaClassGenerator.Console/Program.cs b/XmlSchemaClassGenerator.Console/Program.cs index f29fdd1f..773ab244 100644 --- a/XmlSchemaClassGenerator.Console/Program.cs +++ b/XmlSchemaClassGenerator.Console/Program.cs @@ -90,7 +90,7 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l { "cc|complexTypesForCollections", "generate complex types for collections (default is true)", v => generateComplexTypesForCollections = v != null }, }; - var files = options.Parse(args); + var globsAndUris = options.Parse(args); if (showHelp) { @@ -98,7 +98,24 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l return; } - files = files.SelectMany(f => Glob.ExpandNames(f)).Concat(files.Where(f => Uri.IsWellFormedUriString(f, UriKind.Absolute))).ToList(); + var uris = new List(); + foreach (var globOrUri in globsAndUris) + { + if (Uri.IsWellFormedUriString(globOrUri, UriKind.Absolute)) + { + uris.Add(globOrUri); + continue; + } + + var expandedGlob = Glob.ExpandNames(globOrUri).ToList(); + if (expandedGlob.Count == 0) + { + System.Console.WriteLine($"No files found for '{globOrUri}'"); + Environment.Exit(1); + } + + uris.AddRange(expandedGlob); + } var namespaceMap = namespaces.Select(n => ParseNamespace(n, namespacePrefix)).ToNamespaceProvider(key => { @@ -150,7 +167,7 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l if (verbose) { generator.Log = s => System.Console.Out.WriteLine(s); } - generator.Generate(files); + generator.Generate(uris); } static KeyValuePair ParseNamespace(string nsArg, string namespacePrefix)