From 4c0d39ad368b5298b219a692c4c006e1b9e1ba61 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Fri, 9 Dec 2022 14:52:13 +0800 Subject: [PATCH] accept file:// and asset:// URIs on linux --- linux/include/polyvox_filament/resource_loader.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/linux/include/polyvox_filament/resource_loader.hpp b/linux/include/polyvox_filament/resource_loader.hpp index 6263d33c..ee0157f0 100644 --- a/linux/include/polyvox_filament/resource_loader.hpp +++ b/linux/include/polyvox_filament/resource_loader.hpp @@ -27,12 +27,19 @@ ResourceBuffer loadResource(const char* name) { string name_str(name); auto id = _i++; + // this functions accepts URIs, so + // - file:// points to a file on the filesystem + // - asset:// points to an asset, usually resolved relative to the current working directory + // - no prefix is presumed to be an absolute file path if (name_str.rfind("file://", 0) == 0) { name_str = name_str.substr(7); + } else if(name_str.rfind("asset://", 0) == 0) { + name_str = name_str.substr(7); + name_str = string(cwd) + string("/") + name_str; + } else { + } - name_str = string(cwd) + string("/") + name_str; - std::cout << "Loading resource at " << name_str.c_str() << std::endl; streampos length;