Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
ea7fc15
- grim: read back only used draw invocations, fix out of range active…
SoapyMan Nov 8, 2026
98150c5
- matsystem: fix transient uniform data overwritten before use, the b…
SoapyMan Nov 8, 2026
41cd1d1
- font: add eqfont2 format (msdf / mtsdf / sdf / psdf atlases from ms…
SoapyMan Nov 9, 2026
d3dd3ad
- deps: add msdfgen 1.13 core as static library
SoapyMan Nov 9, 2026
9f74879
- e2Core: add file system source control with Perforce provider (p4 c…
SoapyMan Nov 9, 2026
10f717a
- texcooker: fix refactor
SoapyMan Nov 10, 2026
5cf46b5
- deps: add SMAA area and search lookup textures (iryoku/smaa, MIT) a…
SoapyMan Nov 10, 2026
f37c3a9
- core: add ESourceControlFileType parameter to CheckoutSourceControl…
SoapyMan Nov 10, 2026
b2b8682
- math: fix TVec2D, TVec3D, TVec4D operator != returning true only wh…
SoapyMan Nov 12, 2026
159014c
- ds: fix BufferedArrayStorage::getSL accessing the protected Dynamic…
SoapyMan Nov 13, 2026
8a3be74
- docs: add codestyle rule to take sizeof of the variable or element …
SoapyMan Nov 14, 2026
f2ed39c
- math: RemapValClamp handles an empty range A == B (C below A, D oth…
SoapyMan Nov 14, 2026
b96e9d6
- math: add PolygonSignedArea2D, PolygonConvexPartition2D and Polylin…
SoapyMan Nov 17, 2026
b440b37
- math: add IsPointInPolygon2D
SoapyMan Nov 17, 2026
92c4858
- fs: source control status (none, not connected, connecting, online,…
SoapyMan Nov 17, 2026
f78b211
- nvrhi: VK - select the present semaphore by acquired image index, r…
SoapyMan Nov 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 101 additions & 4 deletions core/e2core/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,20 @@ bool CFileSystem::Init(bool editorMode)
AddPackage(packageName, type, mountPath);
}

// source control is for development builds only
#if !defined(_RETAIL) && !defined(_PROFILE)
// p4 finds its client config (P4CONFIG) from the working directory
m_sourceControl = ISourceControl::Create(g_eqCore->GetConfig(), *fsConfig, GetAbsoluteFullPath(SP_ROOT, "."));
#endif

m_isInit = true;
return true;
}

void CFileSystem::Shutdown()
{
m_isInit = false;
m_sourceControl = nullptr;
m_fsPackages.clear(true);
m_findDatas.clear(true);
m_directories.clear(true);
Expand Down Expand Up @@ -486,9 +493,22 @@ IFileStreamPtr CFileSystem::Open(const char* filename, int openFlags, int search
if (isWrite && !spInfo.writePath)
return false;

// source control checks out the file before writing and adds it once it is created
EqString scFullPath;
bool scFileCreated = false;
if (isWrite && m_sourceControl)
{
scFullPath = GetAbsoluteFullPath(SP_DIRECT, filePath);
scFileCreated = fast_stat(scFullPath, nullptr) != 0;
m_sourceControl->PrepareFileWrite(scFullPath, SC_FILETYPE_AUTO);
}

COSFile osFile;
if (osFile.Open(filePath, osModeFlags))
{
if (scFileCreated)
m_sourceControl->FinishFileWrite(scFullPath, SC_FILETYPE_AUTO);

fileHandle = IFileStreamPtr(CRefPtr_new(COSFileStream, filename, std::move(osFile)));
return true;
}
Expand Down Expand Up @@ -750,7 +770,10 @@ EqStringRef CFileSystem::GetAbsoluteFullPath(ESearchPath search, const char* dir

bool CFileSystem::FileRemove(const char* filename, ESearchPath search ) const
{
const EqStringRef path = GetAbsolutePath(search, filename);
const EqString path = GetAbsolutePath(search, filename);

if (m_sourceControl && m_sourceControl->RemoveFile(GetAbsoluteFullPath(SP_DIRECT, path)))
return true;

return remove(path) == 0;
}
Expand Down Expand Up @@ -780,10 +803,84 @@ bool CFileSystem::RemoveDir(const char* dirname, ESearchPath search ) const

bool CFileSystem::Rename(const char* oldNameOrPath, const char* newNameOrPath, ESearchPath search) const
{
const EqStringRef oldPath = GetAbsolutePath(search, oldNameOrPath);
const EqStringRef newPath = GetAbsolutePath(search, newNameOrPath);
const EqString oldPath = GetAbsolutePath(search, oldNameOrPath);
const EqString newPath = GetAbsolutePath(search, newNameOrPath);

if (!m_sourceControl)
return rename(oldPath, newPath) == 0;

// directories are renamed without source control
const EqString oldFullPath = GetAbsoluteFullPath(SP_DIRECT, oldPath);
if (DirExist(oldFullPath, SP_DIRECT))
return rename(oldPath, newPath) == 0;

const EqString newFullPath = GetAbsoluteFullPath(SP_DIRECT, newPath);
if (m_sourceControl->RenameFile(oldFullPath, newFullPath))
return true;

if (rename(oldPath, newPath) != 0)
return false;

// renamed file which is not in the depot is added as a new one
if (fast_stat(newFullPath, nullptr) == 0)
m_sourceControl->FinishFileWrite(newFullPath, SC_FILETYPE_AUTO);

return true;
}

void CFileSystem::PushSourceControlChangelist(const char* description)
{
if (m_sourceControl)
m_sourceControl->PushChangelist(description);
}

void CFileSystem::PopSourceControlChangelist()
{
if (m_sourceControl)
m_sourceControl->PopChangelist();
}

bool CFileSystem::IsSourceControlEnabled() const
{
return m_sourceControl && m_sourceControl->IsAvailable();
}

ESourceControlStatus CFileSystem::GetSourceControlStatus() const
{
return m_sourceControl ? m_sourceControl->GetStatus() : SC_STATUS_NONE;
}

ESourceControlStatus CFileSystem::SetSourceControlOnline(bool online)
{
return m_sourceControl ? m_sourceControl->SetOnline(online) : SC_STATUS_NONE;
}

void CFileSystem::SetSourceControlStatusCallback(const SourceControlStatusFunc& func)
{
if (m_sourceControl)
m_sourceControl->SetStatusCallback(func);
}

void CFileSystem::CheckoutSourceControlFiles(const char* fileOrDirName, ESearchPath search, ESourceControlFileType fileType)
{
if (!m_sourceControl)
return;

const EqString fullPath = GetAbsoluteFullPath(SP_DIRECT, GetAbsolutePath(search, fileOrDirName));
if (DirExist(fullPath, SP_DIRECT))
m_sourceControl->CheckoutDir(fullPath);
else
m_sourceControl->PrepareFileWrite(fullPath, fileType);
}

void CFileSystem::AddSourceControlFile(const char* fileName, ESearchPath search, ESourceControlFileType fileType)
{
if (!m_sourceControl)
return;

return rename(oldPath, newPath) == 0;
const EqString fullPath = GetAbsoluteFullPath(SP_DIRECT, GetAbsolutePath(search, fileName));
if (fast_stat(fullPath, nullptr) == 0)
m_sourceControl->FinishFileWrite(fullPath, fileType);
}

bool CFileSystem::WalkOverSearchPaths(int searchFlags, const char* fileName, const SPWalkFunc& func) const
Expand Down
22 changes: 20 additions & 2 deletions core/e2core/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once
#include "core/IFileSystem.h"
#include "core/platform/OSFile.h"
#include "SourceControl.h"

class CBasePackageReader;
struct FSSearchPathInfo;
Expand Down Expand Up @@ -124,7 +125,22 @@ class CFileSystem : public IFileSystem
void FindClose(FSFindData* findData);
bool FindIsDirectory(FSFindData* findData) const;
int FindGetDirIndex(FSFindData* findData) const;


//------------------------------------------------------------
// Source control
//------------------------------------------------------------

void PushSourceControlChangelist(const char* description);
void PopSourceControlChangelist();
bool IsSourceControlEnabled() const;
ESourceControlStatus GetSourceControlStatus() const;
ESourceControlStatus SetSourceControlOnline(bool online);
void SetSourceControlStatusCallback(const SourceControlStatusFunc& func);
void CheckoutSourceControlFiles(const char* fileOrDirName, ESearchPath search, ESourceControlFileType fileType);
void AddSourceControlFile(const char* fileName, ESearchPath search, ESourceControlFileType fileType);

ISourceControl* GetSourceControl() const { return m_sourceControl.Ptr(); }

//-------------------------
bool IsInitialized() const { return m_isInit; }

Expand All @@ -147,7 +163,9 @@ class CFileSystem : public IFileSystem
Array<IPackFileReaderPtr> m_fsPackages{ PP_SL }; // package serving as FS layers

Array<FSFindData*> m_findDatas{ PP_SL };


ISourceControlPtr m_sourceControl;

bool m_isInit{ false };
};

Loading
Loading