Permalink
Browse files

Make write_cfg more friendly to a symlinked lacuna.yml

  • Loading branch information...
1 parent 80f4eea commit e31d258c23465b7417cbb256a59b0791c9c12441 @jmazon jmazon committed with tsee Dec 10, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/Games/Lacuna/Client.pm
View
4 lib/Games/Lacuna/Client.pm
@@ -4,6 +4,7 @@ use strict;
use warnings;
use Carp 'croak';
use File::Temp qw( tempfile );
+use Cwd qw( abs_path );
our $VERSION = '0.01';
use constant DEBUG => 1;
@@ -156,6 +157,9 @@ sub write_cfg {
eval {
my $target = $self->cfg_file();
+ # preserve symlinks: operate directly at destination
+ $target = abs_path $target;
+
# save data to a temporary, so we don't risk trashing the target
my ($tfh, $tempfile) = tempfile("$target.XXXXXXX"); # croaks on err
print {$tfh} $yml or die $!;

0 comments on commit e31d258

Please sign in to comment.