Voltray Engine Docs
Loading...
Searching...
No Matches
WorkspaceManager Class Reference

Manages all workspace operations including creation, loading, and persistence. More...

#include <Workspace.h>

Static Public Member Functions

static bool Initialize ()
 Initialize the workspace manager and load existing workspaces.
 
static std::vector< WorkspaceGetAllWorkspaces ()
 Get all available workspaces.
 
static bool CreateWorkspace (const std::string &name, const std::filesystem::path &path, const std::string &description="")
 Create a new workspace with standard directory structure.
 
static bool RemoveWorkspace (const std::filesystem::path &workspacePath)
 Remove a workspace from the managed list (doesn't delete files)
 
static bool UpdateLastOpened (const std::filesystem::path &workspacePath)
 Update last opened time for a workspace.
 
static const WorkspaceGetCurrentWorkspace ()
 Get the currently active workspace.
 
static bool SetCurrentWorkspace (const std::filesystem::path &workspacePath)
 Set the current active workspace.
 
static bool SaveWorkspaces ()
 Save workspace list to persistent storage.
 
static bool LoadWorkspaces ()
 Load workspace list from persistent storage.
 
static bool IsValidWorkspaceDirectory (const std::filesystem::path &path)
 Check if a directory is a valid Voltray workspace.
 
static int CleanupInvalidWorkspaces ()
 Remove invalid workspaces from the list (paths that no longer exist)
 

Detailed Description

Manages all workspace operations including creation, loading, and persistence.

This class handles:

  • Creating new workspaces with proper directory structure (NO global assets)
  • Loading and saving workspace lists to/from JSON config files
  • Managing the currently active workspace
  • Cleaning up invalid workspaces (deleted directories)

Note: Global assets (cube, sphere, etc.) are managed by UserDataManager, not individual workspaces. Each workspace contains only user-specific content.

Member Function Documentation

◆ CleanupInvalidWorkspaces()

int WorkspaceManager::CleanupInvalidWorkspaces ( )
static

Remove invalid workspaces from the list (paths that no longer exist)

Returns
Number of workspaces removed

◆ CreateWorkspace()

bool WorkspaceManager::CreateWorkspace ( const std::string &  name,
const std::filesystem::path &  path,
const std::string &  description = "" 
)
static

Create a new workspace with standard directory structure.

Parameters
nameDisplay name for the workspace
pathDirectory path where workspace will be created
descriptionOptional description
Returns
true if created successfully

◆ GetAllWorkspaces()

std::vector< Workspace > WorkspaceManager::GetAllWorkspaces ( )
static

Get all available workspaces.

Returns
Vector of all workspaces (including invalid ones)

◆ GetCurrentWorkspace()

const Workspace * WorkspaceManager::GetCurrentWorkspace ( )
static

Get the currently active workspace.

Returns
Pointer to current workspace, nullptr if none active

◆ Initialize()

bool WorkspaceManager::Initialize ( )
static

Initialize the workspace manager and load existing workspaces.

Returns
true if successful

◆ IsValidWorkspaceDirectory()

bool WorkspaceManager::IsValidWorkspaceDirectory ( const std::filesystem::path &  path)
static

Check if a directory is a valid Voltray workspace.

Parameters
pathDirectory path to check
Returns
true if contains workspace marker file

◆ LoadWorkspaces()

bool WorkspaceManager::LoadWorkspaces ( )
static

Load workspace list from persistent storage.

Returns
true if loaded successfully

◆ RemoveWorkspace()

bool WorkspaceManager::RemoveWorkspace ( const std::filesystem::path &  workspacePath)
static

Remove a workspace from the managed list (doesn't delete files)

Parameters
workspacePathPath to the workspace to remove
Returns
true if removed successfully

◆ SaveWorkspaces()

bool WorkspaceManager::SaveWorkspaces ( )
static

Save workspace list to persistent storage.

Returns
true if saved successfully

◆ SetCurrentWorkspace()

bool WorkspaceManager::SetCurrentWorkspace ( const std::filesystem::path &  workspacePath)
static

Set the current active workspace.

Parameters
workspacePathPath to the workspace to set as current
Returns
true if set successfully

◆ UpdateLastOpened()

bool WorkspaceManager::UpdateLastOpened ( const std::filesystem::path &  workspacePath)
static

Update last opened time for a workspace.

Parameters
workspacePathPath to the workspace
Returns
true if updated successfully

The documentation for this class was generated from the following files: