MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / ParsePathFileName

Function ParsePathFileName

external/ImGuiFileDialog/ImGuiFileDialog.cpp:775–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773 }
774
775 IGFD::Utils::PathStruct ParsePathFileName(const std::string& vPathFileName) override {
776 IGFD::Utils::PathStruct res;
777 if (!vPathFileName.empty()) {
778 std::string pfn = vPathFileName;
779 std::string separator(1u, PATH_SEP);
780 IGFD::Utils::ReplaceString(pfn, "\\", separator);
781 IGFD::Utils::ReplaceString(pfn, "/", separator);
782 size_t lastSlash = pfn.find_last_of(separator);
783 if (lastSlash != std::string::npos) {
784 res.name = pfn.substr(lastSlash + 1);
785 res.path = pfn.substr(0, lastSlash);
786 res.isOk = true;
787 }
788 size_t lastPoint = pfn.find_last_of('.');
789 if (lastPoint != std::string::npos) {
790 if (!res.isOk) {
791 res.name = pfn;
792 res.isOk = true;
793 }
794 res.ext = pfn.substr(lastPoint + 1);
795 IGFD::Utils::ReplaceString(res.name, "." + res.ext, "");
796 }
797 if (!res.isOk) {
798 res.name = std::move(pfn);
799 res.isOk = true;
800 }
801 }
802 return res;
803 }
804
805 std::vector<IGFD::FileInfos> ScanDirectory(const std::string& vPath) override {
806 std::vector<IGFD::FileInfos> res;

Callers

nothing calls this directly

Calls 2

moveFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected