mirror of
https://github.com/RGBCube/serenity
synced 2025-07-12 13:57:35 +00:00
HackStudio: Absolutize project paths before opening them
Relative paths cause issues in a couple of ways: - `open_project()` sets the working directory to that path, and then opens a project at that same path. This means opening `./foo` goes to `./foo`, and then tries to open `./foo/foo`. - Even with that rearranged, we would then have issues with trying to open files, because again we would try to open `./foo/foo/file` instead of `./foo/file`. - The relative path would get saved in "Recent Projects" which is wrong. Absolutizing the path before using it means we avoid these issues, and without having to rearchitect everything. :^)
This commit is contained in:
parent
6db4d3b898
commit
dd9f3c980f
2 changed files with 7 additions and 5 deletions
|
@ -18,6 +18,7 @@ Project::Project(ByteString const& root_path)
|
|||
|
||||
OwnPtr<Project> Project::open_with_root_path(ByteString const& root_path)
|
||||
{
|
||||
VERIFY(LexicalPath(root_path).is_absolute());
|
||||
if (!FileSystem::is_directory(root_path))
|
||||
return {};
|
||||
return adopt_own(*new Project(root_path));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue