From 8efab6b5f8e5fbc61377beb200b33f77addddd9c Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Fri, 5 Jul 2024 17:09:57 -0300 Subject: [PATCH] Cleanup, less brittle --- src/runtime.cr | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/runtime.cr b/src/runtime.cr index 41932d4..af4f61e 100644 --- a/src/runtime.cr +++ b/src/runtime.cr @@ -27,11 +27,12 @@ module Runtime elsif File.exists? runtime Log.info { "Using directory #{runtime} as runtime" } runtime_base = "#{runtime}" - runtime_files = Dir.glob("#{runtime_base}/**/*") + runtime_files = Dir.glob("#{runtime_base}/**/*").select { |file| File.file?(file) } + runtime_files = runtime_files.map { |file| Path[file].normalize.to_s } else raise Exception.new("Can't find runtime #{runtime}") end - {runtime_base, runtime_files.reject(&.starts_with? "#{runtime_base}template")} + {runtime_base, runtime_files.reject(&.starts_with? Path[runtime_base, "template"].normalize.to_s)} end def self.template_files(runtime : String) : {String, Array(String)} @@ -44,7 +45,8 @@ module Runtime elsif File.exists? runtime Log.info { "Using directory #{runtime} as runtime" } template_base = "#{runtime}/template" - template_files = Dir.glob("#{template_base}/**/*") + template_files = Dir.glob("#{template_base}/**/*").select { |file| File.file?(file) } + template_files = template_files.map { |file| Path[file].normalize.to_s } else raise Exception.new("Can't find runtime #{runtime}") end