From 44ad7cb2b8f0533ae98b1784d2ba0a7ab75edf35 Mon Sep 17 00:00:00 2001 From: Toru Tomita Date: Wed, 5 Nov 2014 16:17:33 +0900 Subject: [PATCH] fixed that OSError: [Errno 18] Invalid cross-device link --- apksmash.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apksmash.py b/apksmash.py index a425cab..a8cbb74 100644 --- a/apksmash.py +++ b/apksmash.py @@ -34,6 +34,7 @@ import re import os import tempfile +import shutil print "Starting fixstrings and apk analysis...\n" @@ -520,8 +521,9 @@ def perm_to_string(line): smaliOut.close() os.close(tmp_fd) os.remove(smali_name) - os.rename(tmp_name, smali_name) - + if not os.path.exists(os.path.dirname(smali_name)): + os.makedirs(os.path.dirname(smali_name)) + shutil.move(tmp_name, smali_name) print "Done Search. Writing output: " + outputfilename