simple change "relativePath" variable location

This commit is contained in:
2025-07-09 17:51:42 +08:00
parent 448c162705
commit 365134ce77

View File

@ -50,8 +50,7 @@ namespace Hazel
for (auto& directory : std::filesystem::directory_iterator(m_CurrentDirectory)) for (auto& directory : std::filesystem::directory_iterator(m_CurrentDirectory))
{ {
auto& path = directory.path(); auto& path = directory.path();
auto relativePath = std::filesystem::relative(directory.path(), g_AssetPath); std::string filePathString = path.filename().string();
std::string filePathString = relativePath.filename().string();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
@ -61,6 +60,7 @@ namespace Hazel
if (ImGui::BeginDragDropSource()) if (ImGui::BeginDragDropSource())
{ {
auto relativePath = std::filesystem::relative(path, g_AssetPath);
const wchar_t* itemPath = relativePath.c_str(); const wchar_t* itemPath = relativePath.c_str();
ImGui::SetDragDropPayload("CONTENT_BROSWER_ITEM", itemPath, (wcslen(itemPath) + 1) * sizeof(wchar_t), ImGuiCond_Once); ImGui::SetDragDropPayload("CONTENT_BROSWER_ITEM", itemPath, (wcslen(itemPath) + 1) * sizeof(wchar_t), ImGuiCond_Once);
ImGui::EndDragDropSource(); ImGui::EndDragDropSource();