diff --git a/src/moonchart/backend/FormatDetector.hx b/src/moonchart/backend/FormatDetector.hx index 237a2f3..6758af6 100644 --- a/src/moonchart/backend/FormatDetector.hx +++ b/src/moonchart/backend/FormatDetector.hx @@ -172,6 +172,14 @@ class FormatDetector settings = resolveSettings(settings); final files:Array = inputFiles.resolve(); + + for (possibleFile in files) + { + if (!Util.fileExists(possibleFile)) + { + files.remove(possibleFile); + } + } var possibleFormats:Array = settings.possibleFormats; var hasMeta:Bool = (files.length > 1); @@ -228,7 +236,7 @@ class FormatDetector var contents:Array = []; for (i in files) contents.push(Util.getText(i)); - + return findFromContents(contents, {possibleFormats: possibleFormats}); } diff --git a/src/moonchart/backend/Util.hx b/src/moonchart/backend/Util.hx index ebe7e60..9d03bc1 100644 --- a/src/moonchart/backend/Util.hx +++ b/src/moonchart/backend/Util.hx @@ -42,6 +42,17 @@ class Util #end } + public static dynamic function fileExists(path:String):Bool + { + #if sys + return FileSystem.exists(path); + #elseif openfl + return Assets.exists(path); + #else + return false; + #end + } + /** * Returns if a given path is a folder or not */