Description:
testdata import now looks for *1*.in when finding raw dir
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@437 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r206:14c27e1a6e89 - - 1 file changed: 1 inserted, 1 deleted
@@ -40,25 +40,25 | |||||
|
40 | if ext=='.tar.gz' or ext=='.tgz' |
|
40 | if ext=='.tar.gz' or ext=='.tgz' |
|
41 | cmd = "tar -zxvf #{testdata_filename} -C #{extract_dir}" |
|
41 | cmd = "tar -zxvf #{testdata_filename} -C #{extract_dir}" |
|
42 | elsif ext=='.tar' |
|
42 | elsif ext=='.tar' |
|
43 | cmd = "tar -xvf #{testdata_filename} -C #{extract_dir}" |
|
43 | cmd = "tar -xvf #{testdata_filename} -C #{extract_dir}" |
|
44 | elsif ext=='.zip' |
|
44 | elsif ext=='.zip' |
|
45 | cmd = "unzip -o #{testdata_filename} -d #{extract_dir}" |
|
45 | cmd = "unzip -o #{testdata_filename} -d #{extract_dir}" |
|
46 | else |
|
46 | else |
|
47 | return nil |
|
47 | return nil |
|
48 | end |
|
48 | end |
|
49 |
|
49 | ||
|
50 | system(cmd) |
|
50 | system(cmd) |
|
51 |
|
51 | ||
|
52 | - files = Dir["#{extract_dir}/**/1*.in"] |
|
52 | + files = Dir["#{extract_dir}/**/*1*.in"] |
|
53 | return nil if files.length==0 |
|
53 | return nil if files.length==0 |
|
54 |
|
54 | ||
|
55 | return File.dirname(files[0]) |
|
55 | return File.dirname(files[0]) |
|
56 | end |
|
56 | end |
|
57 |
|
57 | ||
|
58 | def self.save_testdata_file(problem_name, tempfile) |
|
58 | def self.save_testdata_file(problem_name, tempfile) |
|
59 | ext = TestdataImporter.long_ext(tempfile.original_filename) |
|
59 | ext = TestdataImporter.long_ext(tempfile.original_filename) |
|
60 | testdata_filename = File.join(Dir.tmpdir,"#{problem_name}#{ext}") |
|
60 | testdata_filename = File.join(Dir.tmpdir,"#{problem_name}#{ext}") |
|
61 |
|
61 | ||
|
62 | return nil if tempfile=="" |
|
62 | return nil if tempfile=="" |
|
63 |
|
63 | ||
|
64 | if tempfile.instance_of?(Tempfile) |
|
64 | if tempfile.instance_of?(Tempfile) |
You need to be logged in to leave comments.
Login now