Skip to content

Commit

Permalink
bugfix parent directory for dump output
Browse files Browse the repository at this point in the history
  • Loading branch information
struppigel committed Aug 3, 2017
1 parent e70f513 commit 8fccf7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Binary file modified progs/PortexAnalyzer.jar
Binary file not shown.
14 changes: 8 additions & 6 deletions src/main/java/com/github/katjahahn/tools/PortExAnalyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ import java.nio.file.Files
*/
object PortExAnalyzer {

private val version = """version: 0.7.3
private val version = """version: 0.7.4
|author: Karsten Hahn
|last update: 1. August 2017""".stripMargin
|last update: 3. August 2017""".stripMargin

private val title = """PortEx Analyzer""" + NL

private val usage = """usage:
| java -jar PortexAnalyzer.jar -v
| java -jar PortexAnalyzer.jar -h
| java -jar PortexAnalyzer.jar --repair <file>
| java -jar PortexAnalyzer.jar --dump <all|resources|overlay|sections|ico>
| java -jar PortexAnalyzer.jar --dump <all|resources|overlay|sections|ico> <imagefile>
| java -jar PortexAnalyzer.jar --diff <filelist or folder>
| java -jar PortexAnalyzer.jar --pdiff <file1> <file2> <imagefile>
| java -jar PortexAnalyzer.jar [-a] [-o <outfile>] [-p <imagefile> [-bps <bytes>]] [-i <folder>] <PEfile>
Expand Down Expand Up @@ -143,7 +143,7 @@ object PortExAnalyzer {
if (options.contains('output)) {
writeFileTypeReport(file, new File(options('output)))
} else {
println("The given file is no PE file!" + NL +
println("The given file is no PE file!" + NL + file.getAbsolutePath + NL +
"Try '--repair' option if you think it is a broken PE." + NL)
printFileTypeReport(file)
}
Expand Down Expand Up @@ -185,7 +185,9 @@ object PortExAnalyzer {
private def dumpStuff(file: File, dumpOption: String) = {
try {
val peData = PELoader.loadPE(file)
val outFolder = Paths.get(file.getParentFile.getAbsolutePath, "portex.dumps")
val outFolder = if (file.getParentFile != null) {
Paths.get(file.getParentFile.getAbsolutePath, "portex.dumps")
} else Paths.get("portex.dumps")
if (!outFolder.toFile.exists) {
Files.createDirectory(outFolder)
}
Expand All @@ -209,7 +211,7 @@ object PortExAnalyzer {
System.err.println("There is already a file named " + outFolder.toFile.getAbsolutePath + " that is not a folder!")
}
} catch {
case e: Exception => System.err.println("The given file is no PE file!")
case e: Exception => System.err.println(e.getMessage); e.printStackTrace();
}
}

Expand Down

0 comments on commit 8fccf7d

Please sign in to comment.