Fix subdir again

This commit is contained in:
Mike Nolan 2024-12-30 05:49:11 -06:00
parent 76cec2b269
commit 7541651a06
1 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#include "TessesFramework/Filesystem/SubdirFilesystem.hpp"
#include "TessesFramework/Filesystem/LocalFS.hpp"
#include <iostream>
namespace Tesses::Framework::Filesystem
{
@ -26,11 +27,19 @@ namespace Tesses::Framework::Filesystem
VFSPath SubdirFilesystem::ToParent(VFSPath path)
{
return VFSPath(this->path, path.CollapseRelativeParents());
return this->path / path.CollapseRelativeParents();
}
SubdirFilesystem::SubdirFilesystem(VFS* parent, VFSPath path, bool owns)
{
this->parent = parent;
if(dynamic_cast<LocalFilesystem*>(parent) != nullptr)
{
Tesses::Framework::Filesystem::LocalFilesystem lfs;
auto curDir = std::filesystem::current_path();
auto myPath = lfs.SystemToVFSPath(curDir.string()) / path;
this->path = myPath.CollapseRelativeParents();
}
else
this->path = path;
this->owns=owns;
}