PR Comments

This commit is contained in:
émeryc
2023-07-09 23:33:39 -04:00
parent a73f185f94
commit dca9096459
3 changed files with 11 additions and 5 deletions

View File

@@ -40,7 +40,8 @@ class MyEntityScript is ScriptableEntity {
#include <src/Rendering/Textures/Material.h>
namespace Nuake {
namespace Nuake
{
// TODO: add filetree in same panel
void FileSystemUI::Draw()
@@ -170,11 +171,12 @@ namespace Nuake {
ImGui::OpenPopup(hoverMenuId.c_str());
m_hasClickedOnFile = true;
}
if (ImGui::BeginPopup(hoverMenuId.c_str()))
{
if (ImGui::MenuItem("Delete"))
{
if(FileSystem::RemoveFile(file->GetAbsolutePath().c_str()) != 0)
if(FileSystem::RemoveFile(file->GetAbsolutePath()) != 0)
{
Logger::Log("Failed to remove file: " + file->GetAbsolutePath(), CRITICAL);
}
@@ -202,7 +204,10 @@ namespace Nuake {
void FileSystemUI::DrawContextMenu()
{
if (!m_hasClickedOnFile && ImGui::IsMouseReleased(1) && ImGui::IsWindowHovered())
{
ImGui::OpenPopup("window_hover_menu");
}
if (ImGui::BeginPopup("window_hover_menu"))
{
if (ImGui::MenuItem("New folder"))
@@ -401,6 +406,7 @@ namespace Nuake {
DrawContextMenu();
m_hasClickedOnFile = false;
ImGui::EndTable();
}

View File

@@ -166,9 +166,9 @@ namespace Nuake
fileWriter.close();
}
int FileSystem::RemoveFile(char const* path)
int FileSystem::RemoveFile(const std::string& path)
{
return std::remove(path);
return std::remove(path.c_str());
}
Ref<Directory> FileSystem::GetFileTree()

View File

@@ -43,7 +43,7 @@ namespace Nuake
static bool BeginWriteFile(const std::string path);
static bool WriteLine(const std::string line);
static void EndWriteFile();
static int RemoveFile(char const* path);
static int RemoveFile(const std::string& path);
};
class File