From 37566245234aaa59e60bb0e4ead0211bdad6bc9b Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sun, 20 Sep 2009 20:45:01 -0500 Subject: [PATCH] fix ZipArchive changing current directory --- lib/WebGUI/Asset/File/ZipArchive.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Asset/File/ZipArchive.pm b/lib/WebGUI/Asset/File/ZipArchive.pm index 8f8de4c22..7a11d4838 100644 --- a/lib/WebGUI/Asset/File/ZipArchive.pm +++ b/lib/WebGUI/Asset/File/ZipArchive.pm @@ -22,6 +22,8 @@ use WebGUI::Utility; use Archive::Tar; use Archive::Zip; +use Cwd (); +use Scope::Guard (); @@ -67,7 +69,9 @@ sub unzip { my $filename = shift; my $filepath = $storage->getPath(); - chdir $filepath; + my $cwd = Cwd::cwd(); + chdir $filepath; + my $dir_guard = Scope::Guard->new(sub { chdir $cwd }); my $i18n = WebGUI::International->new($self->session,"Asset_ZipArchive"); if ($filename =~ m/\.zip/i) {