Skip to content

Commit

Permalink
Raise an error when source dir is not writable
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTallet committed Mar 23, 2023
1 parent e1dbe69 commit 1655868
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/universal_importer/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def initialize()
return unless @source_file_path.is_a?(String)

@source_dir = File.dirname(@source_file_path)

# Source dir must be writable to host hard links we'll create later.
raise "Source dir of model to import is not writable: #{@source_dir}"\
unless File.writable?(@source_dir)

@source_filename = File.basename(@source_file_path)

create_link_to_source_file
Expand Down Expand Up @@ -115,7 +120,7 @@ def initialize()
rescue StandardError => exception

UI.messagebox(
'Universal Importer Error: ' + exception.message +
'Universal Importer Error: ' + exception.message + "\n" +
"\n" + exception.backtrace.first.to_s + "\n" +
"\n" + 'Universal Importer Version: ' + VERSION
)
Expand Down

0 comments on commit 1655868

Please sign in to comment.