mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
PR Review comments
This commit is contained in:
@@ -92,7 +92,7 @@ int main(int argc, char* argv[])
|
||||
editor.BuildFonts();
|
||||
|
||||
Ref<Nuake::Project> project = Nuake::Project::New();
|
||||
FileSystem::SetRootDirectory(FileSystem::RemoveFileFromPath(projectPath));
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
|
||||
|
||||
project->FullPath = projectPath;
|
||||
project->Deserialize(FileSystem::ReadFile(projectPath, true));
|
||||
@@ -143,7 +143,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (shouldLoadProject)
|
||||
{
|
||||
FileSystem::SetRootDirectory(FileSystem::RemoveFileFromPath(projectPath));
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
|
||||
|
||||
auto project = Project::New();
|
||||
auto projectFileData = FileSystem::ReadFile(projectPath, true);
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Nuake
|
||||
{
|
||||
// Parse the project and load it.
|
||||
std::string projectPath = FileDialog::OpenFile(".project");
|
||||
FileSystem::SetRootDirectory(FileSystem::RemoveFileFromPath(projectPath));
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
|
||||
Ref<Project> project = Project::New();
|
||||
if (!project->Deserialize(FileSystem::ReadFile(projectPath, true)))
|
||||
{
|
||||
|
||||
@@ -1291,7 +1291,7 @@ namespace Nuake {
|
||||
if (projectPath == "") // Hit cancel.
|
||||
return;
|
||||
|
||||
FileSystem::SetRootDirectory(FileSystem::RemoveFileFromPath(projectPath));
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
|
||||
Ref<Project> project = Project::New();
|
||||
if (!project->Deserialize(FileSystem::ReadFile(projectPath, true)))
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Nuake
|
||||
{
|
||||
if (ImGui::MenuItem("Show in File Explorer"))
|
||||
{
|
||||
OS::OpenInFileExplorer(file->GetAbsolutePath());
|
||||
OS::ShowInFileExplorer(file->GetAbsolutePath());
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Nuake
|
||||
SaveRecentFile();
|
||||
|
||||
std::string projectPath = _Projects[SelectedProject].Path;
|
||||
FileSystem::SetRootDirectory(FileSystem::RemoveFileFromPath(projectPath));
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
|
||||
|
||||
auto project = Project::New();
|
||||
auto projectFileData = FileSystem::ReadFile(projectPath, true);
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Nuake
|
||||
return false;
|
||||
}
|
||||
|
||||
FileSystem::SetRootDirectory(FileSystem::RemoveFileFromPath(project->FullPath));
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(project->FullPath));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Nuake
|
||||
return fs::relative(absolutePath, rootPath).generic_string();
|
||||
}
|
||||
|
||||
std::string FileSystem::RemoveFileFromPath(const std::string& fullPath)
|
||||
std::string FileSystem::GetParentPath(const std::string& fullPath)
|
||||
{
|
||||
std::filesystem::path pathObj(fullPath);
|
||||
return pathObj.parent_path().string();
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Nuake
|
||||
|
||||
static void Scan();
|
||||
static std::string AbsoluteToRelative(const std::string& path);
|
||||
static std::string RemoveFileFromPath(const std::string& fullPath);
|
||||
static std::string GetParentPath(const std::string& fullPath);
|
||||
static Ref<Directory> GetFileTree();
|
||||
static Ref<File> GetFile(const std::string& path);
|
||||
static std::string GetFileNameFromPath(const std::string& path);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "OS.h"
|
||||
|
||||
#include <chrono>
|
||||
#include "String.h"
|
||||
#include <Windows.h>
|
||||
|
||||
using namespace Nuake;
|
||||
@@ -11,7 +10,7 @@ int OS::GetTime()
|
||||
return static_cast<int>(std::chrono::system_clock::now().time_since_epoch().count());
|
||||
}
|
||||
|
||||
void OS::OpenInFileExplorer(const std::string& filePath)
|
||||
void OS::ShowInFileExplorer(const std::string& filePath)
|
||||
{
|
||||
ShellExecuteA(nullptr, "open", "explorer.exe", ("/select," + std::string(filePath)).c_str(), nullptr, SW_SHOWDEFAULT);
|
||||
}
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
class OS
|
||||
{
|
||||
public:
|
||||
static int GetTime();
|
||||
static void OpenInFileExplorer(const std::string& filePath);
|
||||
static void ShowInFileExplorer(const std::string& filePath);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user