Skip to content

Commit 9cc4baa

Browse files
committed
chore: Add getter and expose ecsact files getter
1 parent 046109b commit 9cc4baa

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

Source/EcsactEditor/Private/EcsactEditor.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "EcsactEditor.h"
22
#include "Async/Async.h"
33
#include "Async/TaskGraphInterfaces.h"
4+
#include "CoreGlobals.h"
5+
#include "EcsactUnreal/Ecsact.h"
46
#include "Editor.h"
57
#include "Engine/GameViewportClient.h"
68
#include "ISettingsModule.h"
@@ -86,13 +88,6 @@ static auto GetDirectoryWatcher() -> IDirectoryWatcher* {
8688
return watcher.Get();
8789
}
8890

89-
static auto GetAllEcsactFiles() -> TArray<FString> {
90-
auto& fm = FPlatformFileManager::Get().GetPlatformFile();
91-
auto files = TArray<FString>{};
92-
fm.FindFilesRecursively(files, *SourceDir(), TEXT(".ecsact"));
93-
return files;
94-
}
95-
9691
auto FEcsactEditorModule::SpawnEcsactCli(
9792
const TArray<FString>& Args,
9893
FOnReceiveLine OnReceiveLine,
@@ -618,6 +613,19 @@ auto FEcsactEditorModule::OnEcsactSettingsModified() -> bool {
618613
return true;
619614
}
620615

616+
auto FEcsactEditorModule::Get() -> FEcsactEditorModule& {
617+
return FModuleManager::Get().GetModuleChecked<FEcsactEditorModule>(
618+
"EcsactEditor"
619+
);
620+
}
621+
622+
auto FEcsactEditorModule::GetAllEcsactFiles() -> TArray<FString> {
623+
auto& fm = FPlatformFileManager::Get().GetPlatformFile();
624+
auto files = TArray<FString>{};
625+
fm.FindFilesRecursively(files, *SourceDir(), TEXT(".ecsact"));
626+
return files;
627+
}
628+
621629
#undef LOCTEXT_NAMESPACE
622630

623631
IMPLEMENT_MODULE(FEcsactEditorModule, EcsactEditor)

Source/EcsactEditor/Public/EcsactEditor.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#pragma once
22

33
#include "CoreMinimal.h"
4+
#include "EcsactUnreal/Ecsact.h"
45
#include "Modules/ModuleManager.h"
6+
#include "HAL/PlatformFileManager.h"
7+
#include "Misc/Paths.h"
58

69
DECLARE_LOG_CATEGORY_EXTERN(EcsactEditor, Log, All);
710

8-
class FEcsactEditorModule : public IModuleInterface {
11+
class ECSACTEDITOR_API FEcsactEditorModule : public IModuleInterface {
912
FDelegateHandle SourcesWatchHandle;
1013
FDelegateHandle PluginBinariesWatchHandle;
1114
TMap<FString, FString> CodegenPluginHotReloadNames;
@@ -34,6 +37,8 @@ class FEcsactEditorModule : public IModuleInterface {
3437
FOnExitDelegate OnExit
3538
) -> void;
3639

40+
static auto GetAllEcsactFiles() -> TArray<FString>;
41+
3742
auto RunCodegen() -> void;
3843
auto RunBuild() -> void;
3944

@@ -42,4 +47,6 @@ class FEcsactEditorModule : public IModuleInterface {
4247
auto PreUnloadCallback() -> void override;
4348
auto PostLoadCallback() -> void override;
4449
auto SupportsDynamicReloading() -> bool override;
50+
51+
static auto Get() -> FEcsactEditorModule&;
4552
};

0 commit comments

Comments
 (0)