From bb98d8a8a0b7baf00cc7c46fceb564d5f70b74b7 Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Thu, 7 May 2015 09:39:48 -0500 Subject: [PATCH] Use model-path as a fallback for rocket asset lookup --- panda/src/rocket/rocketFileInterface.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/panda/src/rocket/rocketFileInterface.cxx b/panda/src/rocket/rocketFileInterface.cxx index f7d91ee76f..04bc27c96a 100644 --- a/panda/src/rocket/rocketFileInterface.cxx +++ b/panda/src/rocket/rocketFileInterface.cxx @@ -41,8 +41,18 @@ Open(const Rocket::Core::String& path) { PT(VirtualFile) file = _vfs->get_file(fn); if (file == NULL) { - rocket_cat.error() << "Failed to find " << fn << "\n"; - return (Rocket::Core::FileHandle) NULL; + // failed? Try model-path as a Panda-friendly fallback. + if (!fn.resolve_filename(get_model_path())) { + rocket_cat.error() << "Could not resolve " << fn + << " along the model-path (currently: " << get_model_path() << ")\n"; + return (Rocket::Core::FileHandle) NULL; + } + + file = _vfs->get_file(fn); + if (file == NULL) { + rocket_cat.error() << "Failed to get " << fn << ", found on model-path\n"; + return (Rocket::Core::FileHandle) NULL; + } } istream *str = file->open_read_file(true);