Embedding a filesystem in an executable?

£可爱£侵袭症+ 提交于 2019-12-10 21:28:33

问题


I'm just sort of curious: If I wanted to embed a filesystem in an executable, I assume I'd just embed an image of the filesystem using objcopy. However, what sort of filesystem should I use? Is there going to be an easy library for directly accessing the filesystem image?

I don't have any use for this, so responses like "don't do it, use actual files instead" are irrelevant.


回答1:


There exist so-called virtual file system implementations, which were designed with custom storage in mind. To name a few: our Solid File System, CodeBase File System, Single File System by AidAim.

Most of them use files as the container, some (eg. our SolFS) let you have container in custom places and access it via callbacks.

Depending on practical requirements you can use ZIP or even TAR format as well.

If you want to expose the filesystem contained in your executable to the OS so that other applications could read it, then one of our virtual storage solutions (CallbackDisk or Callback File System) will do the job for you on Windows. On Linux and MacOS X there exist other ways to do this, including FUSE and MacFUSE libraries (analogs to our CBFS).



来源:https://stackoverflow.com/questions/6546651/embedding-a-filesystem-in-an-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!