--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/10/08 21:22:30 1.85 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/10/08 21:57:54 1.87 @@ -82,15 +82,12 @@ my $editsup = $::CONN && $::CONN->{editor_support} or return; - # putting the password into the env is somewhat tasteless -# local $ENV{CFPLUS_LOGIN} = $::PROFILE->{user}; -# local $ENV{CFPLUS_PASSWORD} = $::PROFILE->{password}; -# local $ENV{CFPLUS_UPLOAD} = $::CONN->{upload}; - my ($pid, $fh); unless ($pid = open $fh, "-|:utf8", "-") { $SIG{__DIE__} = sub { - warn "@_\n"; + my $msg = $_[0]; + $msg =~ s/\n+/\n/; + warn "FATAL: $msg"; CFPlus::_exit 99; }; @@ -131,6 +128,10 @@ if (1) { # upload a map my $mapname = $::CONN->{map_info}[0]; + my $mappath = "$mapdir/$mapname"; + + -e $mappath and die "$mappath already exists\n"; + print "getting map revision for $mapname...\n"; # try to get the most recent head revision, what a hack, @@ -144,6 +145,31 @@ my $map = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?rev=$rev"))->decoded_content; + my $meta = { + %$editsup, + path => $mapname, + revision => $rev, + cf_login => $::PROFILE->{user}, + }; + + require File::Basename; + require File::Path; + + File::Path::mkpath (File::Basename::dirname ($mappath)); + open my $fh, ">:raw:perlio", "$mappath.meta" + or die "$mappath.meta: $!\n"; + print $fh CFPlus::to_json $meta; + close $fh; + open my $fh, ">:raw:perlio:utf8", $mappath + or die "$mappath: $!\n"; + print $fh $map; + close $fh; + + print "saved as $mappath\n"; + + print "invoking editor...\n"; + exec "/root/s2/gce $mappath";#d# + # now upload it # require HTTP::Request::Common; # @@ -174,9 +200,6 @@ } } - print "invoking editor...\n"; - exec "/root/s2/gce";#d# - CFPlus::_exit; }