diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-07-20 14:10:47 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-07-20 14:18:21 +0300 |
commit | 7f97ad549e8ef2050c662b8160745402e84e8006 (patch) | |
tree | 2f7ef1d32bf81b33cbbdb0d34a59e45b269c0ac7 /generator/nanopb_generator.py | |
parent | f2f9f8a9ed2f59e4ed229f09fc95f9168cc4b473 (diff) |
Give better messages about the .options file path.
Update issue 124
Status: FixedInGit
Diffstat (limited to 'generator/nanopb_generator.py')
-rwxr-xr-x | generator/nanopb_generator.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 3bc8b39a..c7371887 100755 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -1000,19 +1000,28 @@ def process_file(filename, fdesc, options): fdesc = descriptor.FileDescriptorSet.FromString(data).file[0] # Check if there is a separate .options file + had_abspath = False try: optfilename = options.options_file % os.path.splitext(filename)[0] except TypeError: # No %s specified, use the filename as-is optfilename = options.options_file - + had_abspath = True + if os.path.isfile(optfilename): if options.verbose: sys.stderr.write('Reading options from ' + optfilename + '\n') Globals.separate_options = read_options_file(open(optfilename, "rU")) else: + # If we are given a full filename and it does not exist, give an error. + # However, don't give error when we automatically look for .options file + # with the same name as .proto. + if options.verbose or had_abspath: + sys.stderr.write('Options file not found: ' + optfilename) + Globals.separate_options = [] + Globals.matched_namemasks = set() # Parse the file |