MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / get_base_dir

Method get_base_dir

modules/gui/gui/src/backend/text_server/ustring.cpp:5397–5472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5395}
5396
5397String String::get_base_dir() const
5398{
5399 int end = 0;
5400
5401 // URL scheme style base.
5402 int basepos = find("://");
5403 if (basepos != -1)
5404 {
5405 end = basepos + 3;
5406 }
5407
5408 // Windows top level directory base.
5409 if (end == 0)
5410 {
5411 basepos = find(":/");
5412 if (basepos == -1)
5413 {
5414 basepos = find(":\\");
5415 }
5416 if (basepos != -1)
5417 {
5418 end = basepos + 2;
5419 }
5420 }
5421
5422 // Windows UNC network share path.
5423 if (end == 0)
5424 {
5425 if (is_network_share_path())
5426 {
5427 basepos = find("/", 2);
5428 if (basepos == -1)
5429 {
5430 basepos = find("\\", 2);
5431 }
5432 int servpos = find("/", basepos + 1);
5433 if (servpos == -1)
5434 {
5435 servpos = find("\\", basepos + 1);
5436 }
5437 if (servpos != -1)
5438 {
5439 end = servpos + 1;
5440 }
5441 }
5442 }
5443
5444 // Unix root directory base.
5445 if (end == 0)
5446 {
5447 if (begins_with("/"))
5448 {
5449 end = 1;
5450 }
5451 }
5452
5453 String rs;
5454 String base;

Callers 1

path_to_fileMethod · 0.80

Calls 5

substrFunction · 0.85
findFunction · 0.50
lengthFunction · 0.50
rfindMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected