MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / IsAbsolute

Method IsAbsolute

src/Nazara/Core/File.cpp:683–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681 */
682
683 bool File::IsAbsolute(const String& filePath)
684 {
685 String path(filePath.Trimmed());
686 if (path.IsEmpty())
687 return false;
688
689 path = NormalizeSeparators(path);
690
691 #ifdef NAZARA_PLATFORM_WINDOWS
692 if (path.Match("?:*")) // Ex: C:\Hello
693 return true;
694 else if (path.Match("\\\\*")) // Ex: \\Laptop
695 return true;
696 else if (path.StartsWith('\\')) // Special : '\' referring to the root
697 return true;
698 else
699 return false;
700 #elif defined(NAZARA_PLATFORM_POSIX)
701 return path.StartsWith('/');
702 #else
703 #error OS case not implemented
704 #endif
705 }
706
707 /*!
708 * \brief Normalizes the file path

Callers

nothing calls this directly

Calls 4

TrimmedMethod · 0.80
IsEmptyMethod · 0.80
MatchMethod · 0.80
StartsWithMethod · 0.80

Tested by

no test coverage detected