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

Method CreateDirectoryIfNotExist

ImGuiFileDialog.cpp:672–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670 return false;
671 }
672 bool CreateDirectoryIfNotExist(const std::string& vName) override {
673 bool res = false;
674 if (!vName.empty()) {
675 if (!IsDirectoryExist(vName)) {
676#ifdef _IGFD_WIN_
677 std::wstring wname = IGFD::Utils::UTF8Decode(vName);
678 if (CreateDirectoryW(wname.c_str(), nullptr)) {
679 res = true;
680 }
681#elif defined(__EMSCRIPTEN__) // _IGFD_WIN_
682 std::string str = std::string("FS.mkdir('") + vName + "');";
683 emscripten_run_script(str.c_str());
684 res = true;
685#elif defined(_IGFD_UNIX_)
686 char buffer[PATH_MAX] = {};
687 snprintf(buffer, PATH_MAX, "mkdir -p \"%s\"", vName.c_str());
688 const int dir_err = std::system(buffer);
689 if (dir_err != -1) {
690 res = true;
691 }
692#endif // _IGFD_WIN_
693 if (!res) {
694 std::cout << "Error creating directory " << vName << std::endl;
695 }
696 }
697 }
698
699 return res;
700 }
701
702 std::vector<IGFD::PathDisplayedName> GetDevicesList() override {
703 std::vector<IGFD::PathDisplayedName> res;

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected