MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / stref_file_path

Function stref_file_path

StereoKitC/libraries/stref.cpp:390–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388///////////////////////////////////////////
389
390void stref_file_path(const stref_t &filename, stref_t &out_path, stref_t &out_name) {
391 out_path = stref_t{ filename.start, 0 };
392 int32_t end = filename.length;
393 int32_t slash1 = stref_lastof(filename, '\\');
394 int32_t slash2 = stref_lastof(filename, '/');
395 uint32_t start = (slash1 > slash2 ? slash1 : slash2) + 1;
396 out_name = stref_substr(filename, start, end-start);
397
398 if (stref_indexof(out_name, '.') != -1) {
399 // Has a '.', must be a filename!
400 out_path.length = (int)start-1 < 0 ? 0 : start-1;
401 }
402}
403
404///////////////////////////////////////////
405

Callers

nothing calls this directly

Calls 3

stref_lastofFunction · 0.85
stref_substrFunction · 0.85
stref_indexofFunction · 0.85

Tested by

no test coverage detected