MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ resolve_path()

static std::string MayaFlux::IO::FileReader::resolve_path ( const std::string &  filepath)
inlinestatic

Resolve a filepath against the project source root if not found as-is.

Absolute paths are returned unchanged. Relative paths are tried as-is first, then prefixed with SOURCE_DIR. Returns the original path if neither resolves, allowing the caller to fail naturally.

Parameters
filepathPath as supplied by the caller.
Returns
Resolved path string.

Definition at line 271 of file FileReader.hpp.

272 {
273 namespace fs = std::filesystem;
274 auto normalized = std::string(filepath);
275 std::ranges::replace(normalized, '\\', '/');
276
277 if (fs::path(normalized).is_absolute())
278 return normalized;
279 if (fs::exists(normalized))
280 return normalized;
281 auto from_cwd = fs::current_path() / normalized;
282 if (fs::exists(from_cwd))
283 return from_cwd.string();
284 auto from_root = fs::path(Config::SOURCE_DIR) / normalized;
285 if (fs::exists(from_root))
286 return from_root.string();
287 return normalized;
288 }
std::vector< double > normalized(const std::vector< double > &data, double target_peak)
Normalize single-channel data (non-destructive)
Definition Yantra.cpp:588

References MayaFlux::normalized().

Referenced by MayaFlux::IO::FileReaderRegistry::create_reader(), MayaFlux::IO::ImageReader::open(), MayaFlux::IO::ModelReader::open(), MayaFlux::IO::SoundFileReader::open(), and MayaFlux::IO::VideoFileReader::open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: