diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index 9d3cf51e2..746d16b34 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -2758,10 +2758,21 @@ namespace PascalABCCompiler { string dir = Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive.Replace(Path.DirectorySeparatorChar + "*.pas", "")); foreach (string file in Directory.EnumerateFiles(dir, "*.pas")) + { + if (!File.Exists(file)) + throw new FileNotFound(file, cd.location); files.Add(file); + } + } else - files.Add(Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive)); + { + string file = Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive); + if (!File.Exists(file)) + throw new FileNotFound(file, cd.location); + files.Add(file); + } + } @@ -2770,8 +2781,7 @@ namespace PascalABCCompiler List namespace_modules = new List(); foreach (string file in files) { - if (!File.Exists(file)) - throw new FileNotFound(file); + SyntaxTree.compilation_unit tree = GetNamespaceSyntaxTree(file); if (!(tree is SyntaxTree.unit_module)) throw new NamespaceModuleExpected(tree.source_context); diff --git a/Compiler/Errors.cs b/Compiler/Errors.cs index af7f06ca3..e39fb660d 100644 --- a/Compiler/Errors.cs +++ b/Compiler/Errors.cs @@ -3,11 +3,11 @@ namespace PascalABCCompiler { - public class FileNotFound : TreeConverter.CompilationError + public class FileNotFound : TreeConverter.CompilationErrorWithLocation { private string _file_name; - public FileNotFound(string file_name) + public FileNotFound(string file_name, TreeRealization.location loc):base(loc) { _file_name=file_name; } @@ -22,8 +22,8 @@ namespace PascalABCCompiler public override string ToString() { - return ("File: "+_file_name+" not found"); - } + return string.Format(StringResources.Get("COMPILATIONERROR_FILE_{0}_NOT_FOUND"), _file_name); + } } diff --git a/bin/Lng/Eng/CompilerErrors.dat b/bin/Lng/Eng/CompilerErrors.dat index 51f1f0bae..d98521542 100644 --- a/bin/Lng/Eng/CompilerErrors.dat +++ b/bin/Lng/Eng/CompilerErrors.dat @@ -14,6 +14,7 @@ RESOURCEFILE_{0}_NOT_FOUND=Resource file '{0}' not found DUPLICATE_USES_UNIT{0}=Duplicate identifier '{0}' in uses section MAINRESOURCE_NOT_ALLOWED=mainresource can not be used with the directives: product, version, company, trademark DUPLICATE_DIRECTIVE{0}=Duplicate directive {0} +FILE_{0}_NOT_FOUND=File '{0}' not found %PREFIX%= COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Internal compiler error in module {0} :'{1}' \ No newline at end of file diff --git a/bin/Lng/Rus/CompilerErrors.dat b/bin/Lng/Rus/CompilerErrors.dat index 942945b9f..50955b7ef 100644 --- a/bin/Lng/Rus/CompilerErrors.dat +++ b/bin/Lng/Rus/CompilerErrors.dat @@ -14,6 +14,7 @@ RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не найден DUPLICATE_USES_UNIT{0}=Повторное подключение модуля {0} в секции uses MAINRESOURCE_NOT_ALLOWED=Недопустимо совместное использование директивы mainresource и директив product, version, company, trademark DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0} +FILE_{0}_NOT_FOUND=Файл '{0}' не найден %PREFIX%= COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутренняя ошибка компилятора в модуле {0} :'{1}' \ No newline at end of file diff --git a/bin/Lng/Ukr/CompilerErrors.dat b/bin/Lng/Ukr/CompilerErrors.dat index 5302a42b0..7138a4527 100644 --- a/bin/Lng/Ukr/CompilerErrors.dat +++ b/bin/Lng/Ukr/CompilerErrors.dat @@ -14,6 +14,7 @@ RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не знайдено DUPLICATE_USES_UNIT{0}=Повторне підключення модуля {0} в секції uses MAINRESOURCE_NOT_ALLOWED=Неприпустимо сумісне використання директиви mainresource і директив product, version, company, trademark DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0} +FILE_{0}_NOT_FOUND=Файл '{0}' не знайдено %PREFIX%= COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутрішня помилка компілятора в модулі {0} :'{1}' \ No newline at end of file