Use absolute pathnames when changing directories.

This commit is contained in:
Bastian Kleineidam 2010-03-10 19:44:48 +01:00
parent 8d60f87b06
commit d6089655b8
5 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,8 @@
0.8 "" (released xx.xx.xxxx)
* Fix path error by using absolute pathname for archive when changing
the current working directory to the unpack directory.
0.7 "3000 Miles to Graceland" (released 8.3.2010) 0.7 "3000 Miles to Graceland" (released 8.3.2010)
* Added support for ALZIP (.alz) archives. * Added support for ALZIP (.alz) archives.

View File

@ -14,12 +14,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the arc program.""" """Archive commands for the arc program."""
import os
def extract_arc (archive, encoding, cmd, **kwargs): def extract_arc (archive, encoding, cmd, **kwargs):
"""Extract a ARC archive.""" """Extract a ARC archive."""
# Since extracted files will be placed in the current directory, # Since extracted files will be placed in the current directory,
# the cwd argument has to be the output directory. # the cwd argument has to be the output directory.
cmdlist = [cmd, 'x', archive] cmdlist = [cmd, 'x', os.path.abspath(archive)]
return (cmdlist, {'cwd': kwargs['outdir']}) return (cmdlist, {'cwd': kwargs['outdir']})
def list_arc (archive, encoding, cmd, **kwargs): def list_arc (archive, encoding, cmd, **kwargs):

View File

@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the cpio program.""" """Archive commands for the cpio program."""
import os
from patoolib import util from patoolib import util
def extract_cpio (archive, encoding, cmd, **kwargs): def extract_cpio (archive, encoding, cmd, **kwargs):
@ -23,7 +24,7 @@ def extract_cpio (archive, encoding, cmd, **kwargs):
'--force-local', '--nonmatching', '"*\.\.*"'] '--force-local', '--nonmatching', '"*\.\.*"']
if kwargs['verbose']: if kwargs['verbose']:
cmdlist.append('-v') cmdlist.append('-v')
cmdlist.extend(['<', archive]) cmdlist.extend(['<', os.path.abspath(archive)])
cmd = " ".join([util.shell_quote(x) for x in cmdlist]) cmd = " ".join([util.shell_quote(x) for x in cmdlist])
return (cmd, {'cwd': kwargs['outdir'], 'shell': True}) return (cmd, {'cwd': kwargs['outdir'], 'shell': True})

View File

@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the lrzip program.""" """Archive commands for the lrzip program."""
import os
from patoolib import util from patoolib import util
def extract_lrzip (archive, encoding, cmd, **kwargs): def extract_lrzip (archive, encoding, cmd, **kwargs):
@ -24,7 +25,7 @@ def extract_lrzip (archive, encoding, cmd, **kwargs):
if kwargs['verbose']: if kwargs['verbose']:
cmdlist.append('-v') cmdlist.append('-v')
outfile = util.get_single_outfile(kwargs['outdir'], archive) outfile = util.get_single_outfile(kwargs['outdir'], archive)
cmdlist.extend(["-o", outfile, archive]) cmdlist.extend(["-o", outfile, os.path.abspath(archive)])
return (cmdlist, {'cwd': kwargs['outdir']}) return (cmdlist, {'cwd': kwargs['outdir']})
def test_lrzip (archive, encoding, cmd, **kwargs): def test_lrzip (archive, encoding, cmd, **kwargs):

View File

@ -14,12 +14,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the nomarch program.""" """Archive commands for the nomarch program."""
import os
def extract_arc (archive, encoding, cmd, **kwargs): def extract_arc (archive, encoding, cmd, **kwargs):
"""Extract a ARC archive.""" """Extract a ARC archive."""
# Since extracted files will be placed in the current directory, # Since extracted files will be placed in the current directory,
# the cwd argument has to be the output directory. # the cwd argument has to be the output directory.
cmdlist = [cmd, archive] cmdlist = [cmd, os.path.abspath(archive)]
return (cmdlist, {'cwd': kwargs['outdir']}) return (cmdlist, {'cwd': kwargs['outdir']})
def list_arc (archive, encoding, cmd, **kwargs): def list_arc (archive, encoding, cmd, **kwargs):