mirror of
https://onedev.site.tesses.net/crosslang
synced 2026-02-08 17:15:45 +00:00
use shared ptrs for stream, vfs and ihttpserver and add progress
This commit is contained in:
@@ -65,7 +65,7 @@ namespace Tesses::CrossLang {
|
||||
return value;
|
||||
}
|
||||
|
||||
void TRootEnvironment::LoadDependency(GC* gc,Tesses::Framework::Filesystem::VFS* vfs, std::pair<std::string,TVMVersion> dep)
|
||||
void TRootEnvironment::LoadDependency(GC* gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, std::pair<std::string,TVMVersion> dep)
|
||||
{
|
||||
for(auto item : this->dependencies)
|
||||
if(item.first == dep.first && item.second.CompareTo(dep.second) >= 0) return;
|
||||
@@ -78,11 +78,11 @@ namespace Tesses::CrossLang {
|
||||
|
||||
if(vfs->RegularFileExists(filename))
|
||||
{
|
||||
Tesses::Framework::Streams::Stream* file = vfs->OpenFile(filename,"rb");
|
||||
auto file = vfs->OpenFile(filename,"rb");
|
||||
GCList ls(gc);
|
||||
TFile* f = TFile::Create(ls);
|
||||
f->Load(gc, file);
|
||||
delete file;
|
||||
|
||||
LoadFileWithDependencies(gc, vfs, f);
|
||||
}
|
||||
else throw VMException("Could not open file: \"" + name + "\".");
|
||||
@@ -100,11 +100,11 @@ namespace Tesses::CrossLang {
|
||||
SyntaxNode n = parser.ParseRoot();
|
||||
CodeGen gen;
|
||||
gen.GenRoot(n);
|
||||
Tesses::Framework::Streams::MemoryStream ms(true);
|
||||
gen.Save(nullptr, &ms);
|
||||
ms.Seek(0,Tesses::Framework::Streams::SeekOrigin::Begin);
|
||||
auto ms = std::make_shared<Tesses::Framework::Streams::MemoryStream>(true);
|
||||
gen.Save(nullptr, ms);
|
||||
ms->Seek(0,Tesses::Framework::Streams::SeekOrigin::Begin);
|
||||
TFile* f = TFile::Create(ls);
|
||||
f->Load(ls.GetGC(),&ms);
|
||||
f->Load(ls.GetGC(),ms);
|
||||
return this->LoadFile(ls.GetGC(), f);
|
||||
}
|
||||
TDictionary* TEnvironment::EnsureDictionary(GC* gc, std::string key)
|
||||
@@ -241,7 +241,7 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
void TRootEnvironment::LoadFileWithDependencies(GC* gc,Tesses::Framework::Filesystem::VFS* vfs, TFile* file)
|
||||
void TRootEnvironment::LoadFileWithDependencies(GC* gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, TFile* file)
|
||||
{
|
||||
this->dependencies.push_back(std::pair<std::string,TVMVersion>(file->name,file->version));
|
||||
for(auto item : file->dependencies)
|
||||
@@ -251,19 +251,19 @@ namespace Tesses::CrossLang {
|
||||
LoadFile(gc, file);
|
||||
|
||||
}
|
||||
void TRootEnvironment::LoadFileWithDependencies(GC* gc,Tesses::Framework::Filesystem::VFS* vfs, Tesses::Framework::Filesystem::VFSPath path)
|
||||
void TRootEnvironment::LoadFileWithDependencies(GC* gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
|
||||
|
||||
if(vfs->RegularFileExists(path))
|
||||
{
|
||||
Tesses::Framework::Streams::Stream* file=vfs->OpenFile(path,"rb");
|
||||
auto file=vfs->OpenFile(path,"rb");
|
||||
GCList ls(gc);
|
||||
TFile* f = TFile::Create(ls);
|
||||
f->Load(gc, file);
|
||||
delete file;
|
||||
Tesses::Framework::Filesystem::SubdirFilesystem dir(vfs,path.GetParent(),false);
|
||||
LoadFileWithDependencies(gc,&dir,f);
|
||||
|
||||
auto dir = std::make_shared<Tesses::Framework::Filesystem::SubdirFilesystem>(vfs,path.GetParent());
|
||||
LoadFileWithDependencies(gc,dir,f);
|
||||
}
|
||||
else throw VMException("Could not open file: \"" + path.GetFileName() + "\".");
|
||||
|
||||
|
||||
@@ -70,23 +70,18 @@ namespace Tesses::CrossLang
|
||||
bool TObjectStream::EndOfStream()
|
||||
{
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
auto res = dict->CallMethod(*ls, "getEndOfStream",{});
|
||||
bool r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->EndOfStream();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
size_t TObjectStream::Read(uint8_t* buff, size_t sz)
|
||||
{
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls2(this->ls->GetGC());
|
||||
@@ -101,16 +96,11 @@ namespace Tesses::CrossLang
|
||||
int64_t r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->Read(buff,sz);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
size_t TObjectStream::Write(const uint8_t* buff, size_t sz)
|
||||
{
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls2(this->ls->GetGC());
|
||||
@@ -123,124 +113,92 @@ namespace Tesses::CrossLang
|
||||
int64_t r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->Write(buff,sz);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
bool TObjectStream::CanRead()
|
||||
{
|
||||
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
auto res = dict->CallMethod(*ls, "getCanRead",{});
|
||||
bool r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->CanRead();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
bool TObjectStream::CanWrite()
|
||||
{
|
||||
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
auto res = dict->CallMethod(*ls, "getCanWrite",{});
|
||||
bool r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->CanWrite();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool TObjectStream::CanSeek()
|
||||
{
|
||||
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
auto res = dict->CallMethod(*ls, "getCanSeek",{});
|
||||
bool r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->CanSeek();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
int64_t TObjectStream::GetPosition()
|
||||
{
|
||||
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
auto res = dict->CallMethod(*ls, "getPosition",{});
|
||||
int64_t r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->GetPosition();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
int64_t TObjectStream::GetLength()
|
||||
{
|
||||
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
auto res = dict->CallMethod(*ls, "getEndOfStream",{});
|
||||
bool r;
|
||||
if(GetObject(res,r)) return r;
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
return strm->stream->GetLength();
|
||||
}
|
||||
|
||||
return Tesses::Framework::Streams::Stream::GetLength();
|
||||
}
|
||||
void TObjectStream::Flush()
|
||||
{
|
||||
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
dict->CallMethod(*ls, "Flush",{});
|
||||
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
strm->stream->Flush();
|
||||
}
|
||||
|
||||
}
|
||||
void TObjectStream::Seek(int64_t pos, Tesses::Framework::Streams::SeekOrigin whence)
|
||||
{
|
||||
TDictionary* dict;
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
dict->CallMethod(*ls, "Seek",{pos,(int64_t)(whence == Tesses::Framework::Streams::SeekOrigin::Begin ? 0 : whence == Tesses::Framework::Streams::SeekOrigin::Current ? 1 : 2) });
|
||||
}
|
||||
else if(GetObjectHeap(this->obj, strm))
|
||||
{
|
||||
strm->stream->Seek(pos,whence);
|
||||
}
|
||||
|
||||
}
|
||||
TObjectStream::~TObjectStream()
|
||||
{
|
||||
@@ -248,37 +206,6 @@ namespace Tesses::CrossLang
|
||||
}
|
||||
|
||||
|
||||
TStreamHeapObject* TStreamHeapObject::Create(GCList& ls, Tesses::Framework::Streams::Stream* strm)
|
||||
{
|
||||
TStreamHeapObject* heapObj = new TStreamHeapObject();
|
||||
GC* _gc = ls.GetGC();
|
||||
ls.Add(heapObj);
|
||||
_gc->Watch(heapObj);
|
||||
heapObj->stream = strm;
|
||||
return heapObj;
|
||||
}
|
||||
TStreamHeapObject* TStreamHeapObject::Create(GCList* ls, Tesses::Framework::Streams::Stream* strm)
|
||||
{
|
||||
TStreamHeapObject* heapObj = new TStreamHeapObject();
|
||||
GC* _gc = ls->GetGC();
|
||||
ls->Add(heapObj);
|
||||
_gc->Watch(heapObj);
|
||||
heapObj->stream = strm;
|
||||
return heapObj;
|
||||
}
|
||||
TStreamHeapObject::~TStreamHeapObject()
|
||||
{
|
||||
if(this->stream != nullptr)
|
||||
{
|
||||
delete this->stream;
|
||||
}
|
||||
}
|
||||
void TStreamHeapObject::Close()
|
||||
{
|
||||
if(this->stream != nullptr)
|
||||
{
|
||||
delete this->stream;
|
||||
this->stream = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -131,34 +131,26 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
|
||||
}
|
||||
Tesses::Framework::Streams::Stream* TObjectVFS::OpenFile(Tesses::Framework::Filesystem::VFSPath path, std::string mode)
|
||||
std::shared_ptr<Tesses::Framework::Streams::Stream> TObjectVFS::OpenFile(Tesses::Framework::Filesystem::VFSPath path, std::string mode)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->OpenFile(path,mode);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
auto res = dict->CallMethod(ls, "OpenFile",{path,mode});
|
||||
TStreamHeapObject* strm;
|
||||
if(GetObjectHeap(res,strm))
|
||||
std::shared_ptr<Tesses::Framework::Streams::Stream> strm;
|
||||
if(GetObject(res,strm))
|
||||
{
|
||||
return new TObjectStream(this->ls->GetGC(), strm);
|
||||
return strm;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
void TObjectVFS::CreateDirectory(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->CreateDirectory(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -169,12 +161,7 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
void TObjectVFS::DeleteDirectory(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->DeleteDirectory(path);
|
||||
}
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -185,12 +172,7 @@ namespace Tesses::CrossLang {
|
||||
bool TObjectVFS::RegularFileExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->RegularFileExists(path);
|
||||
}
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -206,12 +188,8 @@ namespace Tesses::CrossLang {
|
||||
|
||||
bool TObjectVFS::SymlinkExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->SymlinkExists(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -226,12 +204,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
bool TObjectVFS::CharacterDeviceExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->CharacterDeviceExists(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -246,12 +220,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
bool TObjectVFS::BlockDeviceExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->BlockDeviceExists(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -266,12 +236,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
bool TObjectVFS::SocketFileExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->SocketFileExists(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -286,12 +252,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
bool TObjectVFS::FIFOFileExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->FIFOFileExists(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -306,12 +268,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
bool TObjectVFS::FileExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->FileExists(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -326,12 +284,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
bool TObjectVFS::SpecialFileExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->SpecialFileExists(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -346,12 +300,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
void TObjectVFS::CreateSymlink(Tesses::Framework::Filesystem::VFSPath existingFile, Tesses::Framework::Filesystem::VFSPath symlinkFile)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->CreateSymlink(existingFile,symlinkFile);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -361,12 +311,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
void TObjectVFS::CreateHardlink(Tesses::Framework::Filesystem::VFSPath existingFile, Tesses::Framework::Filesystem::VFSPath newName)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->CreateHardlink(existingFile,newName);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -376,12 +322,7 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
bool TObjectVFS::DirectoryExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->DirectoryExists(path);
|
||||
}
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -396,12 +337,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
void TObjectVFS::DeleteFile(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->DeleteFile(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -411,12 +348,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
void TObjectVFS::DeleteDirectoryRecurse(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->DeleteDirectoryRecurse(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -426,12 +359,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
Tesses::Framework::Filesystem::VFSPathEnumerator TObjectVFS::EnumeratePaths(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->EnumeratePaths(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList* ls=new GCList(this->ls->GetGC());
|
||||
@@ -465,12 +394,8 @@ namespace Tesses::CrossLang {
|
||||
void TObjectVFS::MoveFile(Tesses::Framework::Filesystem::VFSPath src, Tesses::Framework::Filesystem::VFSPath dest)
|
||||
{
|
||||
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->MoveFile(src,dest);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -481,12 +406,8 @@ namespace Tesses::CrossLang {
|
||||
void TObjectVFS::MoveDirectory(Tesses::Framework::Filesystem::VFSPath src, Tesses::Framework::Filesystem::VFSPath dest)
|
||||
{
|
||||
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->MoveDirectory(src,dest);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -497,12 +418,7 @@ namespace Tesses::CrossLang {
|
||||
Tesses::Framework::Filesystem::VFSPath TObjectVFS::ReadLink(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->ReadLink(path);
|
||||
}
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -518,12 +434,8 @@ namespace Tesses::CrossLang {
|
||||
std::string TObjectVFS::VFSPathToSystem(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->VFSPathToSystem(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -538,12 +450,8 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
Tesses::Framework::Filesystem::VFSPath TObjectVFS::SystemToVFSPath(std::string path)
|
||||
{
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
return vfs->vfs->SystemToVFSPath(path);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -559,12 +467,7 @@ namespace Tesses::CrossLang {
|
||||
void TObjectVFS::GetDate(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Date::DateTime& lastWrite, Tesses::Framework::Date::DateTime& lastAccess)
|
||||
{
|
||||
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->GetDate(path,lastWrite,lastAccess);
|
||||
}
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -589,12 +492,8 @@ namespace Tesses::CrossLang {
|
||||
void TObjectVFS::SetDate(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Date::DateTime lastWrite, Tesses::Framework::Date::DateTime lastAccess)
|
||||
{
|
||||
|
||||
TVFSHeapObject* vfs;
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, vfs))
|
||||
{
|
||||
vfs->vfs->SetDate(path,lastWrite,lastAccess);
|
||||
}
|
||||
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
@@ -604,37 +503,14 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
TObjectVFS::~TObjectVFS()
|
||||
{
|
||||
|
||||
TDictionary* dict;
|
||||
if(GetObjectHeap(this->obj, dict))
|
||||
{
|
||||
GCList ls(this->ls->GetGC());
|
||||
dict->CallMethod(ls,"Dispose",{});
|
||||
}
|
||||
delete this->ls;
|
||||
}
|
||||
TVFSHeapObject* TVFSHeapObject::Create(GCList& ls, Tesses::Framework::Filesystem::VFS* vfs)
|
||||
{
|
||||
TVFSHeapObject* heapObj = new TVFSHeapObject();
|
||||
GC* _gc = ls.GetGC();
|
||||
ls.Add(heapObj);
|
||||
_gc->Watch(heapObj);
|
||||
heapObj->vfs = vfs;
|
||||
return heapObj;
|
||||
}
|
||||
TVFSHeapObject* TVFSHeapObject::Create(GCList* ls, Tesses::Framework::Filesystem::VFS* vfs)
|
||||
{
|
||||
TVFSHeapObject* heapObj = new TVFSHeapObject();
|
||||
GC* _gc = ls->GetGC();
|
||||
ls->Add(heapObj);
|
||||
_gc->Watch(heapObj);
|
||||
heapObj->vfs = vfs;
|
||||
return heapObj;
|
||||
}
|
||||
TVFSHeapObject::~TVFSHeapObject()
|
||||
{
|
||||
if(this->vfs != nullptr)
|
||||
delete this->vfs;
|
||||
}
|
||||
void TVFSHeapObject::Close()
|
||||
{
|
||||
if(this->vfs != nullptr)
|
||||
{
|
||||
delete this->vfs;
|
||||
this->vfs = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user