Skip to content

Commit

Permalink
🐛 fixed #949 Module Generator Incorrect Src Path.
Browse files Browse the repository at this point in the history
Improved error rescue specificity.
  • Loading branch information
mvandervoord committed Nov 7, 2024
1 parent 856bbc6 commit 60c24c2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/ceedling/file_path_collection_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def shortest_path_from_working(path)
begin
# Reform path from full absolute to nice, neat relative path instead
(Pathname.new( path ).relative_path_from( @working_dir_path )).to_s
rescue
rescue StandardError
# If we can't form a relative path between these paths, use the absolute
path
end
Expand Down
2 changes: 1 addition & 1 deletion plugins/dependencies/lib/dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def build_lib(blob)
build_path = Pathname.new get_build_path(blob)
relative_build_path = begin
build_path.relative_path_from(source_path)
rescue
rescue StandardError
build_path
end

Expand Down
14 changes: 9 additions & 5 deletions plugins/module_generator/lib/module_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def divine_options(optz={})
:naming => ((defined? MODULE_GENERATOR_NAMING ) ? MODULE_GENERATOR_NAMING : nil ),
:update_svn => ((defined? MODULE_GENERATOR_UPDATE_SVN ) ? MODULE_GENERATOR_UPDATE_SVN : false ),
:test_define => ((defined? MODULE_GENERATOR_TEST_DEFINE ) ? MODULE_GENERATOR_TEST_DEFINE : "TEST" ),
:path_src => ((defined? MODULE_GENERATOR_PATH_SRC ) ? MODULE_GENERATOR_PATH_SRC : nil ),
:path_inc => ((defined? MODULE_GENERATOR_PATH_INC ) ? MODULE_GENERATOR_PATH_INC : nil ),
:path_tst => ((defined? MODULE_GENERATOR_PATH_TST ) ? MODULE_GENERATOR_PATH_TST : nil ),
}

# Add our lookup paths to this, based on overall project configuration
Expand Down Expand Up @@ -99,11 +102,12 @@ def divine_options(optz={})

# Check if using "create[<module_root>:<module_name>]" optional paths from command line.
if optz[:module_root_path].to_s.empty?
# No path specified. Use the first of each list because we have nothing else to base it on
unity_generator_options[:skeleton_path] = unity_generator_options[:paths_src][0]
unity_generator_options[:path_src] = unity_generator_options[:paths_src][0]
unity_generator_options[:path_inc] = unity_generator_options[:paths_inc][0]
unity_generator_options[:path_tst] = unity_generator_options[:paths_tst][0]
# No path specified. Use the one specified in the module generator section if it exists,
# else the first of each list because we have nothing else to base it on
unity_generator_options[:skeleton_path] ||= unity_generator_options[:paths_src][0]
unity_generator_options[:path_src] ||= unity_generator_options[:paths_src][0]
unity_generator_options[:path_inc] ||= unity_generator_options[:paths_inc][0]
unity_generator_options[:path_tst] ||= unity_generator_options[:paths_tst][0]
else
# A path was specified. Do our best to determine which is the best choice based on this information
unity_generator_options[:skeleton_path] = @ceedling[:file_finder_helper].find_best_path_in_collection(optz[:module_root_path], unity_generator_options[:paths_src], :ignore) || unity_generator_options[:paths_src][0]
Expand Down
2 changes: 1 addition & 1 deletion vendor/cmock

0 comments on commit 60c24c2

Please sign in to comment.