@@ -48,6 +48,23 @@ bool EditorSystem::initialize(const JSON::json& systemData)
48
48
m_Inspector.reset (new InspectorDock ());
49
49
m_FileViewer.reset (new FileViewer ());
50
50
m_FileEditor.reset (new FileEditor ());
51
+
52
+ {
53
+ if (!OS::IsDirectory (" game/assets/materials" ))
54
+ {
55
+ OS::CreateDirectoryName (" game/assets/materials" );
56
+ }
57
+
58
+ if (!OS::IsDirectory (" game/assets/scripts" ))
59
+ {
60
+ OS::CreateDirectoryName (" game/assets/scripts" );
61
+ }
62
+
63
+ if (!OS::IsDirectory (" game/assets/scenes" ))
64
+ {
65
+ OS::CreateDirectoryName (" game/assets/scenes" );
66
+ }
67
+ }
51
68
52
69
IMGUI_CHECKVERSION ();
53
70
ImGui::CreateContext ();
@@ -258,11 +275,6 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
258
275
{
259
276
if (ImGui::BeginMenu (" Create Resource" ))
260
277
{
261
- if (!OS::IsDirectory (" game/assets/materials" ))
262
- {
263
- OS::CreateDirectoryName (" game/assets/materials" );
264
- }
265
-
266
278
if (ImGui::BeginCombo (" Resource Type" , newFileTypeName.c_str ()))
267
279
{
268
280
for (auto & [type, typeName] : ResourceFile::s_TypeNames)
@@ -298,12 +310,7 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
298
310
static String newScript;
299
311
if (ImGui::BeginMenu (" Create Script" ))
300
312
{
301
- ImGui::InputText (" Script Name" , &newScript);
302
-
303
- if (!OS::IsDirectory (" game/assets/scripts" ))
304
- {
305
- OS::CreateDirectoryName (" game/assets/scripts" );
306
- }
313
+ ImGui::InputText (" Script Name" , &newScript);
307
314
308
315
String finalNewScriptName = " game/assets/scripts/" + newScript + " .lua" ;
309
316
ImGui::Text (" File Name: %s" , finalNewScriptName.c_str ());
@@ -329,10 +336,6 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
329
336
ImGui::Separator ();
330
337
if (ImGui::BeginMenu (" Create Scene" ))
331
338
{
332
- if (!OS::IsDirectory (" game/assets/scenes" ))
333
- {
334
- OS::CreateDirectoryName (" game/assets/scenes" );
335
- }
336
339
ImGui::InputText (" Scene Name" , &newSceneName, ImGuiInputTextFlags_AlwaysInsertMode);
337
340
if (!newSceneName.empty () && ImGui::Button (" Create" ))
338
341
{
@@ -351,10 +354,6 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
351
354
}
352
355
if (ImGui::BeginMenu (" Open Scene" ))
353
356
{
354
- if (!OS::IsDirectory (" game/assets/scenes" ))
355
- {
356
- OS::CreateDirectoryName (" game/assets/scenes" );
357
- }
358
357
for (auto && levelName : OS::GetFilesInDirectory (" game/assets/scenes/" ))
359
358
{
360
359
if (ImGui::MenuItem (levelName.generic_string ().c_str ()))
0 commit comments