Class: MGMapsExport

Inherits:
Object
  • Object
show all
Defined in:
lib/mgmaps_export.rb

Constant Summary collapse

MAPS_ROOT =
Pathname.new("maps")
EXPORT_ROOT =
Pathname.new("export")

Class Method Summary collapse

Class Method Details

.export(tiles_per_file, hash_size) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mgmaps_export.rb', line 8

def self.export(tiles_per_file, hash_size)
  if EXPORT_ROOT.exist?
    error_dlg('Cannot export: export directory already exists!')
    return
  end

  files = Dir['maps/*/*.mgm']

  catch :cancelled do
    if tiles_per_file > 1
      export_as_mtpf(files, tiles_per_file)
    elsif hash_size > 1
      export_as_hashed(files, hash_size)
    else
      export_as_copy(files)
    end

    create_conf_file(tiles_per_file, hash_size)
    success_msg
  end
end