From afd8bff58e1590eabba9a014c855a5a2b8d7164e Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Mon, 21 Apr 2025 15:50:54 +0800 Subject: [PATCH] remove superseded Linux resource loader --- .../thermion_flutter/resource_loader.hpp | 70 ------------------- 1 file changed, 70 deletions(-) delete mode 100644 thermion_flutter/thermion_flutter/linux/include/thermion_flutter/resource_loader.hpp diff --git a/thermion_flutter/thermion_flutter/linux/include/thermion_flutter/resource_loader.hpp b/thermion_flutter/thermion_flutter/linux/include/thermion_flutter/resource_loader.hpp deleted file mode 100644 index 2ba1af5e..00000000 --- a/thermion_flutter/thermion_flutter/linux/include/thermion_flutter/resource_loader.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef FLUTTER_FILAMENT_LINUX_RESOURCE_LOADER_H -#define FLUTTER_FILAMENT_LINUX_RESOURCE_LOADER_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ResourceBuffer.hpp" - - -static std::map _file_assets; -static uint32_t _i = 0; - -ResourceBuffer loadResource(const char* name) { - - std::cout << "LOADING RESOURCE" << std::endl; - - char cwd[PATH_MAX]; - if (getcwd(cwd, sizeof(cwd)) != NULL) { - std::cout << "Current working dir: " << cwd << std::endl; - } - - 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 asset - 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("/build/linux/x64/debug/bundle/data/flutter_assets/") + name_str; - } - - std::cout << "Loading resource at " << name_str.c_str() << std::endl; - - streampos length; - ifstream is(name_str, ios::binary); - if(!is) { - std::cout << "Failed to find resource at file path " << name_str.c_str() << std::endl; - return ResourceBuffer(nullptr, 0, -1); - } - is.seekg (0, ios::end); - length = is.tellg(); - char * buffer; - buffer = new char [length]; - is.seekg (0, ios::beg); - is.read (buffer, length); - is.close(); - _file_assets[id] = buffer; - return ResourceBuffer(buffer, length, id); -} - -void freeResource(ResourceBuffer rbuf) { - auto it = _file_assets.find(rbuf.id); - if (it != _file_assets.end()) { - free(it->second); - } -} - -#endif \ No newline at end of file