Skip to content

Commit

Permalink
Append STL to filenames with no extensions on export. Fixes #133.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomthom committed Mar 20, 2014
1 parent c4526e7 commit 6907deb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/sketchup-stl/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ def self.model_name
end

def self.select_export_file
template = STL.translate('%s file location')
file_name = "#{model_name()}.#{file_extension()}"
dlg_title = sprintf(template, file_name)
title_template = STL.translate('%s file location')
default_filename = "#{model_name()}.#{file_extension()}"
dialog_title = sprintf(title_template, default_filename)
directory = nil
path = UI.savepanel(dlg_title, directory, file_name)
filename = UI.savepanel(dialog_title, directory, default_filename)
# Ensure the file has a file extensions if the user omitted it.
if File.extname(filename).empty?
filename = "#{filename}.#{file_extension()}"
end
filename
end

def self.export(path, options = OPTIONS)
Expand Down

0 comments on commit 6907deb

Please sign in to comment.