mirror of
https://github.com/revanced/Apktool.git
synced 2024-09-05 22:16:13 +02:00
Throwing exception when decoding to existing directory.
This commit is contained in:
parent
25ec196cfa
commit
43797e0c0d
@ -56,6 +56,11 @@ public class ApkDecoder {
|
||||
|
||||
public void decode() throws AndrolibException {
|
||||
File outDir = getOutDir();
|
||||
|
||||
if (! mForceDelete && outDir.exists()) {
|
||||
throw new OutDirExistsException();
|
||||
}
|
||||
|
||||
try {
|
||||
OS.rmdir(outDir);
|
||||
} catch (BrutException ex) {
|
||||
@ -116,6 +121,10 @@ public class ApkDecoder {
|
||||
mDebug = debug;
|
||||
}
|
||||
|
||||
public void setForceDelete(boolean forceDelete) {
|
||||
mForceDelete = forceDelete;
|
||||
}
|
||||
|
||||
public ResTable getResTable() throws AndrolibException {
|
||||
if (mResTable == null) {
|
||||
mResTable = mAndrolib.getResTable(mApkFile);
|
||||
@ -147,4 +156,5 @@ public class ApkDecoder {
|
||||
private short mDecodeSources = DECODE_SOURCES_SMALI;
|
||||
private short mDecodeResources = DECODE_RESOURCES_FULL;
|
||||
private boolean mDebug = false;
|
||||
private boolean mForceDelete = false;
|
||||
}
|
||||
|
38
src/brut/androlib/OutDirExistsException.java
Normal file
38
src/brut/androlib/OutDirExistsException.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010 Ryszard Wiśniewski <brut.alll@gmail.com>.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package brut.androlib;
|
||||
|
||||
/**
|
||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||
*/
|
||||
public class OutDirExistsException extends AndrolibException {
|
||||
|
||||
public OutDirExistsException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public OutDirExistsException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public OutDirExistsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public OutDirExistsException() {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user