Normalizing paths

This doesn't affect behavior but makes for nicer error messages.
This commit is contained in:
Daniel Wolf 2018-02-07 20:50:35 +01:00
parent f3de163d72
commit 8f1056dc5f
1 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class SpineJson(val filePath: Path) {
?: throw Exception("JSON file is incomplete: Images path is missing." ?: throw Exception("JSON file is incomplete: Images path is missing."
+ "Make sure to check 'Nonessential data' when exporting.") + "Make sure to check 'Nonessential data' when exporting.")
val imagesDirectoryPath = fileDirectoryPath.resolve(relativeImagesDirectory) val imagesDirectoryPath = fileDirectoryPath.resolve(relativeImagesDirectory).normalize()
if (!Files.exists(imagesDirectoryPath)) { if (!Files.exists(imagesDirectoryPath)) {
throw Exception("Could not find images directory relative to the JSON file." throw Exception("Could not find images directory relative to the JSON file."
+ " Make sure the JSON file is in the same directory as the original Spine file.") + " Make sure the JSON file is in the same directory as the original Spine file.")
@ -50,7 +50,7 @@ class SpineJson(val filePath: Path) {
?: throw Exception("JSON file is incomplete: Audio path is missing." ?: throw Exception("JSON file is incomplete: Audio path is missing."
+ "Make sure to check 'Nonessential data' when exporting.") + "Make sure to check 'Nonessential data' when exporting.")
val audioDirectoryPath = fileDirectoryPath.resolve(relativeAudioDirectory) val audioDirectoryPath = fileDirectoryPath.resolve(relativeAudioDirectory).normalize()
if (!Files.exists(audioDirectoryPath)) { if (!Files.exists(audioDirectoryPath)) {
throw Exception("Could not find audio directory relative to the JSON file." throw Exception("Could not find audio directory relative to the JSON file."
+ " Make sure the JSON file is in the same directory as the original Spine file.") + " Make sure the JSON file is in the same directory as the original Spine file.")