Commit 442853e1 authored by hh1966's avatar hh1966
Browse files

Create import_path if it does not exist

parent 5e3d4be6
......@@ -6,6 +6,10 @@ module Chemotion
# create an id for the import
import_id = SecureRandom.uuid
# create the `tmp/imports/` if it does not exist yet
import_path = Import::ImportCollections.import_path
FileUtils.mkdir_p(import_path) unless Dir.exist?(import_path)
# store the file as `tmp/imports/<import_id>.zip`
file_path = Import::ImportCollections.zip_file_path(import_id)
File.open(file_path, 'wb') do |file|
......
......@@ -5,6 +5,9 @@ module Import
# static methods
class << self
def import_path
File.join('tmp', 'import')
end
def zip_file_path(import_id)
File.join('tmp', 'import', "#{import_id}.zip")
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment