@@ -258,6 +258,11 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
258
258
{
259
259
if (ImGui::BeginMenu (" Create Resource" ))
260
260
{
261
+ if (!OS::IsDirectory (" game/assets/materials" ))
262
+ {
263
+ OS::CreateDirectoryName (" game/assets/materials" );
264
+ }
265
+
261
266
if (ImGui::BeginCombo (" Resource Type" , newFileTypeName.c_str ()))
262
267
{
263
268
for (auto & [type, typeName] : ResourceFile::s_TypeNames)
@@ -294,6 +299,11 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
294
299
if (ImGui::BeginMenu (" Create Script" ))
295
300
{
296
301
ImGui::InputText (" Script Name" , &newScript);
302
+
303
+ if (!OS::IsDirectory (" game/assets/scripts" ))
304
+ {
305
+ OS::CreateDirectoryName (" game/assets/scripts" );
306
+ }
297
307
298
308
String finalNewScriptName = " game/assets/scripts/" + newScript + " .lua" ;
299
309
ImGui::Text (" File Name: %s" , finalNewScriptName.c_str ());
@@ -319,6 +329,10 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
319
329
ImGui::Separator ();
320
330
if (ImGui::BeginMenu (" Create Scene" ))
321
331
{
332
+ if (!OS::IsDirectory (" game/assets/scenes" ))
333
+ {
334
+ OS::CreateDirectoryName (" game/assets/scenes" );
335
+ }
322
336
ImGui::InputText (" Scene Name" , &newSceneName, ImGuiInputTextFlags_AlwaysInsertMode);
323
337
if (!newSceneName.empty () && ImGui::Button (" Create" ))
324
338
{
@@ -337,6 +351,10 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
337
351
}
338
352
if (ImGui::BeginMenu (" Open Scene" ))
339
353
{
354
+ if (!OS::IsDirectory (" game/assets/scenes" ))
355
+ {
356
+ OS::CreateDirectoryName (" game/assets/scenes" );
357
+ }
340
358
for (auto && levelName : OS::GetFilesInDirectory (" game/assets/scenes/" ))
341
359
{
342
360
if (ImGui::MenuItem (levelName.generic_string ().c_str ()))
0 commit comments