# HG changeset patch # User Nattee Niparnan # Date 2017-02-28 08:34:50 # Node ID 90afe1fa9431f0877b75efb4db0744b94f37399e # Parent 45474cc69e4cec7bce084089641684e3615cfb52 add feature to import_problem to automatically copy *.txt file and fix the judge script accordingly diff --git a/import_problem b/import_problem --- a/import_problem +++ b/import_problem @@ -145,6 +145,12 @@ end end + #also include any .txt files + Dir.glob("#{testcase_dir}/*.txt") do |file| + puts "copy data file #{file}" + FileUtils.cp(file,"#{problem_dir}") + end + # generating all_tests.cfg puts "generating testcase config file" diff --git a/std-script/judge b/std-script/judge --- a/std-script/judge +++ b/std-script/judge @@ -140,6 +140,12 @@ if language == "python" then Dir["#{test_result_dir}/*.pyc"].each { |file| FileUtils.cp(file,sandbox_dir)} end } + #additionally copy any extra .txt file + data_files = Dir[problem_home + '/*.txt'] + data_files.each do |file| + FileUtils.cp(file,sandbox_dir) + end + begin execute("#{problem_home}/script/run #{language} #{test_num} ", "Error occured during execution of the run script") rescue