-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check that required input files exist (in inputs folder)
- Loading branch information
James
authored and
James
committed
Apr 27, 2019
1 parent
6a212a6
commit 6c64180
Showing
3 changed files
with
48 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
package org.idiosapps | ||
|
||
import java.io.File | ||
|
||
class Filenames { | ||
val inputPrefix: String = "./input/" | ||
val outputPrefix: String = "./output/" | ||
companion object { | ||
val inputPrefix: String = "./input/" | ||
val outputPrefix: String = "./output/" | ||
|
||
val inputHeaderFilename: String = inputPrefix + "header" | ||
val inputTitleFilename: String = inputPrefix + "title" | ||
val inputStoryFilename: String = inputPrefix + "story" | ||
|
||
val inputVocabFilename: String = inputPrefix + "vocab" | ||
val inputKeyNamesFilename: String = inputPrefix + "names" | ||
|
||
val inputHeaderFilename: String = inputPrefix + "header" | ||
val inputTitleFilename: String = inputPrefix + "title" | ||
val inputStoryFilename: String = inputPrefix + "story" | ||
val outputStoryFilename: String = outputPrefix + "outputStory.tex" | ||
val outputPDFFilename: String = outputPrefix + "outputStory.pdf" | ||
|
||
val inputVocabFilename: String = inputPrefix + "vocab" | ||
val inputKeyNamesFilename: String = inputPrefix + "names" | ||
fun checkInputs() { | ||
val inputArray = arrayListOf( | ||
inputHeaderFilename, | ||
inputTitleFilename, | ||
inputStoryFilename, | ||
inputVocabFilename, | ||
inputKeyNamesFilename | ||
) | ||
|
||
val outputStoryFilename: String = outputPrefix + "outputStory.tex" | ||
val outputPDFFilename: String = outputPrefix + "outputStory.pdf" | ||
for (input in inputArray) { | ||
val inputFile = File(input) | ||
if (!inputFile.exists()) { // could also check for size > 0 on required inputs | ||
throw Exception("Input does not exist: $input") | ||
} | ||
} | ||
} | ||
} | ||
} |