Elaztek Developer Hub
Switch Project...
blam!
Editing Kit
Guerilla
Sapien
Tool
Foundry
Libraries
Keystone
Strings
Forums
Discord
Doxygen
Jenkins
Guides
Gitlab
Blamite Game Engine - blam!
00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
set_project_root.hpp
Go to the documentation of this file.
1
#include "../console.h"
2
3
#include <Strings/components/utils/io/io.h>
4
5
#include "
components/diagnostics/logger/logger.h
"
6
#include "
components/diagnostics/crash/crash.h
"
7
#include "
components/content/project/project.h
"
8
9
namespace
Blam::Resources::Console
10
{
17
class
SetProjectRootCommand
:
public
BlamConsoleCommand
18
{
19
private
:
20
void
ChangeProjectRoot(std::string file_path)
21
{
22
if
(!file_path.ends_with(
"/"
))
23
{
24
file_path +=
"/"
;
25
}
26
27
BlamProjectInfo
project_info =
Blam::Content::Project::GetCurrentProjectInfo
();
28
project_info.
content_root
= file_path;
29
project_info.
use_defaults
=
false
;
30
Blam::Content::Project::SetActiveProjectInfo
(project_info);
31
}
32
33
public
:
34
SetProjectRootCommand
()
35
{
36
name
=
"set_project_root"
;
37
description
=
"Updates the content root of the engine. Only available in debug and test"
38
" builds, and is intended for use in conjunction with the Editing Kit."
;
39
40
type
=
BlamCommandType::Builtin
;
41
}
42
43
BlamResult
Execute
(std::vector<std::string> arguments)
44
{
45
if
(arguments.size() == 0)
46
{
47
Blam::Logger::LogEvent
(
"setting content root to application directory"
);
48
ChangeProjectRoot(
""
);
49
return
BlamResult::Success_OK;
50
}
51
52
std::string file_path =
""
;
53
54
for
(
int
i = 0; i < arguments.size(); i++)
55
{
56
if
(i == arguments.size() - 1)
57
{
58
file_path += arguments[i];
59
}
60
else
61
{
62
file_path += arguments[i] +
" "
;
63
}
64
}
65
66
file_path = BlamStrings::Utils::IO::NormalizePath(file_path);
67
68
if
(BlamStrings::Utils::IO::IsDirectory(file_path))
69
{
70
Blam::Logger::LogEvent
(
"setting content root to '"
+ file_path +
"'"
);
71
ChangeProjectRoot(file_path);
72
}
73
else
74
{
75
Blam::Logger::LogEvent
(
"cannot set content root to '"
+ file_path +
"': path does not exist, or is not a directory"
);
76
}
77
78
return
BlamResult::Success_OK;
79
}
80
};
81
}
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition:
aliases.cpp:130
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition:
console.h:36
logger.h
BlamConsoleCommand
Class used to represent a console command.
Definition:
console.h:33
project.h
Blam::Resources::Console::SetProjectRootCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition:
set_project_root.hpp:43
Blam::Content::Project::SetActiveProjectInfo
BLAM void SetActiveProjectInfo(BlamProjectInfo project_info)
Definition:
project.cpp:12
BlamProjectInfo::use_defaults
bool use_defaults
Definition:
project_info.h:7
Blam::Content::Project::GetCurrentProjectInfo
BLAM BlamProjectInfo GetCurrentProjectInfo()
Definition:
project.cpp:7
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition:
console.h:35
BlamProjectInfo
Definition:
project_info.h:5
crash.h
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition:
console.h:40
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition:
abort.hpp:5
Blam::Resources::Console::SetProjectRootCommand
Class for the set_project_root command.
Definition:
set_project_root.hpp:17
BlamProjectInfo::content_root
std::string content_root
Definition:
project_info.h:9
Blam::Resources::Console::SetProjectRootCommand::SetProjectRootCommand
SetProjectRootCommand()
Definition:
set_project_root.hpp:34
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
blam
components
resources
console
commands
set_project_root.hpp
Generated on Mon Jun 8 2026 09:40:33 for Blamite Game Engine - blam! by
1.8.17