schovi / baked_file_system

Virtual File System for Crystal language. Embedding your assets into final binary.
MIT License
177 stars 18 forks source link

Does not find file which has been baked #46

Closed serge-hulne closed 1 year ago

serge-hulne commented 1 year ago

code

require "baked_file_system"

class FileStorage
  extend BakedFileSystem
  bake_folder "../public"
end

path = "../public/index.html"

begin
  file = FileStorage.get path
  p "content = #{file.gets_to_end}"
rescue BakedFileSystem::NoSuchFileError
  puts "File #{path} is missing"
end

file structure

Screenshot 2023-02-23 at 09 14 43
straight-shoota commented 1 year ago

When you're baking a folder, files inside that folder are reachable by their path relative to that folder. The path in the baked file system would be /index.html, not ../public/index.html.

serge-hulne commented 1 year ago

Thank you very much.