1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-05-31 18:41:30 +00:00

Allow omitting the .exe for the -r parameter

This commit is contained in:
Karol Stasiak 2020-08-01 22:20:11 +02:00
parent ea04b1f6c0
commit a9aac4fca3

View File

@ -167,8 +167,14 @@ object Main {
}
errorReporting.debug(s"Total time: ${Math.round((System.nanoTime() - startTime)/1e6)} ms")
c.runFileName.foreach{ program =>
if (!new File(program).exists()) {
errorReporting.error(s"Program $program does not exist")
if (File.separatorChar == '\\') {
if (!new File(program).exists() && !new File(program + ".exe").exists()) {
errorReporting.error(s"Program $program does not exist")
}
} else {
if (!new File(program).exists()) {
errorReporting.error(s"Program $program does not exist")
}
}
val outputAbsolutePath = Paths.get(defaultPrgOutput).toAbsolutePath.toString
val isBatch = File.separatorChar == '\\' && program.toLowerCase(Locale.ROOT).endsWith(".bat")