Skip to content

Commit

Permalink
Fix anti big copy bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTallet committed Jan 10, 2020
1 parent 7502af2 commit c587ed2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
2 changes: 1 addition & 1 deletion source/universal_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Universal Importer plugin namespace.
module UniversalImporter

VERSION = '1.0.6'.freeze
VERSION = '1.0.7'.freeze

# Load translation if it's available for current locale.
TRANSLATE = LanguageHandler.new('uir.strings')
Expand Down
22 changes: 1 addition & 21 deletions source/universal_importer/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,28 +291,8 @@ def copy_to_prog_data_dir
FileUtils.remove_dir(SESSION[:temp_dir])\
if File.exist?(SESSION[:temp_dir])

source_dir = File.dirname(@import_file_path)

if Sketchup.platform == :platform_win

source_dir.gsub!('\\', '/')

end

source_dir_size = Dir.glob(File.join(source_dir, '**', '*'))\
.map{ |file| File.size(file) }.inject(:+)

if source_dir_size.to_i > 1000000000 # 1GB

error_message = 'Folder that contains model is too big... '
error_message += 'Move model and textures to a sub folder.'

raise StandardError.new(error_message)

end

FileUtils.copy_entry(
source_dir,
File.dirname(@import_file_path), # source
SESSION[:temp_dir] # destination
)

Expand Down

0 comments on commit c587ed2

Please sign in to comment.