mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-08 19:16:09 +01:00
minor: input file might not exist.
This commit is contained in:
parent
74ecd31a4d
commit
253a95c98d
@ -18,6 +18,7 @@ package brut.apktool;
|
|||||||
|
|
||||||
import brut.androlib.*;
|
import brut.androlib.*;
|
||||||
import brut.androlib.err.CantFindFrameworkResException;
|
import brut.androlib.err.CantFindFrameworkResException;
|
||||||
|
import brut.androlib.err.InFileNotFoundException;
|
||||||
import brut.androlib.err.OutDirExistsException;
|
import brut.androlib.err.OutDirExistsException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -122,6 +123,11 @@ public class Main {
|
|||||||
"Destination directory (" + outDir.getAbsolutePath() + ") " +
|
"Destination directory (" + outDir.getAbsolutePath() + ") " +
|
||||||
"already exists. Use -f switch if you want to overwrite it.");
|
"already exists. Use -f switch if you want to overwrite it.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
} catch (InFileNotFoundException ex) {
|
||||||
|
System.out.println(
|
||||||
|
"Input file (" + args[i] + ") " +
|
||||||
|
"was not found or was not readable.");
|
||||||
|
System.exit(1);
|
||||||
} catch (CantFindFrameworkResException ex) {
|
} catch (CantFindFrameworkResException ex) {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Can't find framework resources for package of id: " +
|
"Can't find framework resources for package of id: " +
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package brut.androlib;
|
package brut.androlib;
|
||||||
|
|
||||||
|
import brut.androlib.err.InFileNotFoundException;
|
||||||
import brut.androlib.err.OutDirExistsException;
|
import brut.androlib.err.OutDirExistsException;
|
||||||
import brut.androlib.res.AndrolibResources;
|
import brut.androlib.res.AndrolibResources;
|
||||||
import brut.androlib.res.data.ResPackage;
|
import brut.androlib.res.data.ResPackage;
|
||||||
@ -64,6 +65,10 @@ public class ApkDecoder {
|
|||||||
throw new OutDirExistsException();
|
throw new OutDirExistsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! mApkFile.isFile() || ! mApkFile.canRead() ) {
|
||||||
|
throw new InFileNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OS.rmdir(outDir);
|
OS.rmdir(outDir);
|
||||||
} catch (BrutException ex) {
|
} catch (BrutException ex) {
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2011 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package brut.androlib.err;
|
||||||
|
|
||||||
|
import brut.androlib.AndrolibException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
|
*/
|
||||||
|
public class InFileNotFoundException extends AndrolibException {
|
||||||
|
|
||||||
|
public InFileNotFoundException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InFileNotFoundException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InFileNotFoundException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InFileNotFoundException() {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user