MCPcopy Create free account
hub / github.com/dfranx/SHADERed / FileDialog

Method FileDialog

libs/misc/ImFileDialog.cpp:347–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345 }
346
347 FileDialog::FileDialog() {
348 m_isOpen = false;
349 m_type = 0;
350 m_calledOpenPopup = false;
351 m_sortColumn = 0;
352 m_sortDirection = ImGuiSortDirection_Ascending;
353 m_filterSelection = 0;
354 m_inputTextbox[0] = 0;
355 m_pathBuffer[0] = 0;
356 m_searchBuffer[0] = 0;
357 m_newEntryBuffer[0] = 0;
358 m_selectedFileItem = -1;
359 m_zoom = 1.0f;
360
361 m_previewLoader = nullptr;
362 m_previewLoaderRunning = false;
363
364 m_setDirectory(std::filesystem::current_path(), false);
365
366 // favorites are available on every OS
367 FileTreeNode* quickAccess = new FileTreeNode("Quick Access");
368 quickAccess->Read = true;
369 m_treeCache.push_back(quickAccess);
370
371#ifdef _WIN32
372 char username[UNLEN + 1] = { 0 };
373 DWORD username_len = UNLEN + 1;
374 GetUserNameA(username, &username_len);
375
376 std::string userPath = "C:\\Users\\" + std::string(username) + "\\";
377
378 // Quick Access / Bookmarks
379 quickAccess->Children.push_back(new FileTreeNode(userPath + "Desktop"));
380 quickAccess->Children.push_back(new FileTreeNode(userPath + "Documents"));
381 quickAccess->Children.push_back(new FileTreeNode(userPath + "Downloads"));
382 quickAccess->Children.push_back(new FileTreeNode(userPath + "Pictures"));
383
384 // OneDrive
385 FileTreeNode* oneDrive = new FileTreeNode(userPath + "OneDrive");
386 m_treeCache.push_back(oneDrive);
387
388 // This PC
389 FileTreeNode* thisPC = new FileTreeNode("This PC");
390 thisPC->Read = true;
391 if (std::filesystem::exists(userPath + "3D Objects"))
392 thisPC->Children.push_back(new FileTreeNode(userPath + "3D Objects"));
393 thisPC->Children.push_back(new FileTreeNode(userPath + "Desktop"));
394 thisPC->Children.push_back(new FileTreeNode(userPath + "Documents"));
395 thisPC->Children.push_back(new FileTreeNode(userPath + "Downloads"));
396 thisPC->Children.push_back(new FileTreeNode(userPath + "Music"));
397 thisPC->Children.push_back(new FileTreeNode(userPath + "Pictures"));
398 thisPC->Children.push_back(new FileTreeNode(userPath + "Videos"));
399 DWORD d = GetLogicalDrives();
400 for (int i = 0; i < 26; i++)
401 if (d & (1 << i))
402 thisPC->Children.push_back(new FileTreeNode(std::string(1, 'A' + i) + ":"));
403 m_treeCache.push_back(thisPC);
404#else

Callers

nothing calls this directly

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected