# Has anybody tried "baked\_file\_system"?

**URL:** <https://forum.crystal-lang.org/t/has-anybody-tried-baked-file-system/5415>\
**Category:** Help & Support\
**Created:** [February 23, 2023, 8:20am UTC](https://forum.crystal-lang.org/t/has-anybody-tried-baked-file-system/5415 "2023-02-23T08:20:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![serge-hulne](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/serge-hulne/32/1211_2.png) [@serge-hulne](https://forum.crystal-lang.org/u/serge-hulne)\
**Post date:** [February 23, 2023, 8:20am UTC](https://forum.crystal-lang.org/t/has-anybody-tried-baked-file-system/5415/1 "2023-02-23T08:20:39Z")

</div>

I tried it, but it does not seem to work:

> <https://github.com/schovi/baked_file_system/issues/46>
>
> \# code
> 
> \`\`\`
> require "baked\_file\_system"
> 
> class FileStorage
> extend BakedF…ileSystem
> 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
> 
> \<img width="338" alt="Screenshot 2023-02-23 at 09 14 43" src="https://user-images.githubusercontent.com/303502/220853799-91ce07d1-304f-4ae4-9dc4-854e761136f2.png"\>

the codeI tried, is:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![serge-hulne](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/serge-hulne/32/1211_2.png) [@serge-hulne](https://forum.crystal-lang.org/u/serge-hulne)\
**Post date:** [February 23, 2023, 8:50am UTC](https://forum.crystal-lang.org/t/has-anybody-tried-baked-file-system/5415/2 "2023-02-23T08:50:16Z")

</div>

In fact, the correct code (thanks @straight-shoota) is:

```auto
require "baked_file_system"

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

path = "/index.html"

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

```

Basically, the path inside the archive is the path “beyond” (i.e. not including) the orginal folder on which the archiving operation is performed.

In other words, the name of the original folder which has been archived does not act as a “root” inside the archive.
