mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add Diviac conversion to smtk converter CGI script
Plus a little bit of error reporting. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
7cc7feb8f0
commit
faafcd0cfc
2 changed files with 128 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ $CGI::POST_MAX = 1024 * 1024 * 10;
|
|||
|
||||
# Change this to the correct path to binary.
|
||||
my $smtk2ssrf = "../build/smtk2ssrf";
|
||||
my $diviac = "../scripts/diviac.pl";
|
||||
my $logfile = '/tmp/smtk2ssrf.log';
|
||||
|
||||
my $q = CGI->new;
|
||||
|
|
@ -17,6 +18,12 @@ if ($q->upload("uploaded_file")) {
|
|||
my $new_filename = $original_filename;
|
||||
$new_filename =~ s/.*[\/\\]//;
|
||||
$new_filename =~ s/\..*$/.ssrf/;
|
||||
my $converted;
|
||||
if ($q->param('filetype') eq "Diviac") {
|
||||
$converted = `$diviac $tmp_filename`;
|
||||
} else {
|
||||
$converted = `$smtk2ssrf $tmp_filename -`;
|
||||
}
|
||||
|
||||
if (length($converted) > 5) {
|
||||
|
||||
|
|
@ -40,11 +47,11 @@ if ($q->upload("uploaded_file")) {
|
|||
|
||||
print $q->start_multipart_form();
|
||||
|
||||
print $q->h1("Convert Smartrack files to Subsurface");
|
||||
|
||||
print $q->h1("Convert Smartrack and Diviac files to Subsurface");
|
||||
print $q->filefield( -name => "uploaded_file",
|
||||
-size => 50,
|
||||
-maxlength => 200);
|
||||
print $q->popup_menu(-name => "filetype", -values => ["Smartrack", "Diviac"]);
|
||||
print $q->submit();
|
||||
print $q->end_form();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue