📂 golxzn::os::filesystem 📂 1.6.5
golxzn filesystem submodule
Loading...
Searching...
No Matches
📂 golxzn::os::filesystem 📂

golxzn::os::filesystem

Windows Ubuntu MacOS

golxzn::os::filesystem is a simple resource manager which provides basic access to application resources and user directory. golxzn::os::filesystem is dependenceless. There's only STL usage and platform specific headers.

How does it work?

When you initialize this library using golxzn::os::filesystem::initialize method, library does 2 thing:

  1. Looks for assets or res directory starting from current application directory;
  2. Creates application directory

Look for assets or res

This library goes up to the root directory and checks assets or res directory to set read-only resources directory up

Creates application directory

This library creates application directory for data which could be modified at:

  • For Linux: /home/you/.config/your_app_name;
  • For Windows: APPDATA%/your_app_name;
  • For MacOS: /Users/you/Library/Application Support/your_app_name;

CMake integration 1. Clone this repository

git clone https://github.com/golxzn/filesystem.git

2. Add subdirectory

add_subdirectory(filesystem)
target_link_libraries(YourProjectName PUBLIC golxzn::os::filesystem)

3. Include header & initialize

namespace your {
class Image {
public:
explicit YourImage(std::vector<gxzn::os::byte> &&raw_image) {
// Parse your image
}
...
};
class Settings {
public:
explicit YourSettings(std::string &&content) {
// Parse your settings
}
...
};
} // namespace your
int main() {
auto app_settings{ gxzn::os::fs::load_text<your::Settings>("res://settings/application.ini") };
auto splash_screen{ ///< std::shared_ptr<your::Image>
gxzn::os::fs::load_shared_binary<your::Image>(app_settings.get_splash_screen_path())
};
}
Header file with the declaration of the Golxzn Filesystem class.
static error initialize(const std::wstring_view application_name, const std::wstring_view assets_path=default_assets_directory_name)
Initialize the Resource Manager.

You could use either a golxzn::os::filesystem namespace or just gxzn::os::fs:

gxzn::os::fs::initialize("your_app_name");

Thanks

Documentations is powered by: