MCPcopy Create free account
hub / github.com/aiekick/ImGuiFileDialog / ParsePathFileName

Method ParsePathFileName

ImGuiFileDialog.cpp:730–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

728 }
729
730 IGFD::Utils::PathStruct ParsePathFileName(const std::string& vPathFileName) override {
731 IGFD::Utils::PathStruct res;
732 if (!vPathFileName.empty()) {
733 std::string pfn = vPathFileName;
734 std::string separator(1u, PATH_SEP);
735 IGFD::Utils::ReplaceString(pfn, "\\", separator);
736 IGFD::Utils::ReplaceString(pfn, "/", separator);
737 size_t lastSlash = pfn.find_last_of(separator);
738 if (lastSlash != std::string::npos) {
739 res.name = pfn.substr(lastSlash + 1);
740 res.path = pfn.substr(0, lastSlash);
741 res.isOk = true;
742 }
743 size_t lastPoint = pfn.find_last_of('.');
744 if (lastPoint != std::string::npos) {
745 if (!res.isOk) {
746 res.name = pfn;
747 res.isOk = true;
748 }
749 res.ext = pfn.substr(lastPoint + 1);
750 IGFD::Utils::ReplaceString(res.name, "." + res.ext, "");
751 }
752 if (!res.isOk) {
753 res.name = std::move(pfn);
754 res.isOk = true;
755 }
756 }
757 return res;
758 }
759
760 std::vector<IGFD::FileInfos> ScanDirectory(const std::string& vPath) override {
761 std::vector<IGFD::FileInfos> res;

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected