Description:
removes imported testdata file after extracted
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r270:6fd950650700 - - 1 file changed: 2 inserted, 0 deleted

@@ -61,24 +61,26
61 cmd = "tar -xvf #{testdata_filename} -C #{extract_dir}"
61 cmd = "tar -xvf #{testdata_filename} -C #{extract_dir}"
62 elsif ext=='.zip'
62 elsif ext=='.zip'
63 cmd = "unzip -o #{testdata_filename} -d #{extract_dir}"
63 cmd = "unzip -o #{testdata_filename} -d #{extract_dir}"
64 else
64 else
65 return nil
65 return nil
66 end
66 end
67
67
68 system(cmd)
68 system(cmd)
69
69
70 files = Dir["#{extract_dir}/**/*1*.in"]
70 files = Dir["#{extract_dir}/**/*1*.in"]
71 return nil if files.length==0
71 return nil if files.length==0
72
72
73 + File.delete(testdata_filename)
74 +
73 return File.dirname(files[0])
75 return File.dirname(files[0])
74 end
76 end
75
77
76 def save_testdata_file(tempfile)
78 def save_testdata_file(tempfile)
77 ext = TestdataImporter.long_ext(tempfile.original_filename)
79 ext = TestdataImporter.long_ext(tempfile.original_filename)
78 testdata_filename = File.join(Dir.tmpdir,"#{@problem.name}#{ext}")
80 testdata_filename = File.join(Dir.tmpdir,"#{@problem.name}#{ext}")
79
81
80 return nil if tempfile==""
82 return nil if tempfile==""
81
83
82 if tempfile.instance_of?(Tempfile)
84 if tempfile.instance_of?(Tempfile)
83 tempfile.close
85 tempfile.close
84 FileUtils.move(tempfile.path,testdata_filename)
86 FileUtils.move(tempfile.path,testdata_filename)
You need to be logged in to leave comments. Login now