MCPcopy Create free account
hub / github.com/MrDrElliot/LuminaEngine / CopyLooseScripts

Function CopyLooseScripts

Engine/Editor/Source/Cooker/ProjectPackager.cpp:53–125  ·  view source on GitHub ↗

Mirror every non-.lasset /Game/ file under /Game/ for loose-files mode.

Source from the content-addressed store, hash-verified

51 const FLooseRoot Roots[] = { { "/Game", "Game" } };
52
53 for (const FLooseRoot& Root : Roots)
54 {
55 const FFixedString DstRoot = Paths::Combine(OutDir, Root.Top);
56 Filesystem::MakeDirectoryTree(DstRoot);
57
58 const FString Alias(Root.Alias);
59 const FString Prefix = Alias + "/";
60
61 VFS::RecursiveDirectoryIterator(FStringView(*Alias, Alias.Len()), [&](const VFS::FFileInfo& Info)
62 {
63 if (Info.IsDirectory())
64 {
65 return;
66 }
67
68 FStringView Vp(*Info.VirtualPath, Info.VirtualPath.Len());
69 if (EndsWithIgnoreCase(Vp, ".lasset") || IsDevelopmentOnlyGameFile(Vp, true))
70 {
71 return;
72 }
73
74 if (Vp.Len() <= Prefix.Len())
75 {
76 return;
77 }
78 FStringView Relative = Vp.Mid(Prefix.Len());
79
80 TVector<uint8> Bytes;
81 if (!VFS::ReadFile(Bytes, Info.VirtualPath))
82 {
83 return;
84 }
85
86 const FFixedString Dst = Paths::Combine(DstRoot, Relative);
87 if (!Filesystem::WriteFile(Dst, TSpan<const uint8>(Bytes.GetData(), Bytes.Num())))
88 {
89 return;
90 }
91
92 ++Count;
93 LogPackager(LogFunc, *Format(" + {}/{}", Root.Top, Relative));
94 });
95 }
96 return Count;
97 }
98
99 FStringView WithoutLibraryPrefix(const FPackagePlatformRules& Rules, FStringView FileName)
100 {
101 const bool bPrefixed = !Rules.LibraryPrefix.IsEmpty() && FileName.StartsWith(Rules.LibraryPrefix);
102 return bPrefixed ? FileName.Mid(IntCastChecked<int32>(Rules.LibraryPrefix.Len())) : FileName;
103 }
104
105 // The tail every binary of this package ends in, "Development" for a game and "Server-Development" for a server.
106 FString BinaryTail(const FString& Config, bool bServer)
107 {
108 return bServer ? FString("Server-") + Config : Config;
109 }
110

Callers 2

ExtractLooseScriptsMethod · 0.85
PackageMethod · 0.85

Calls 11

EndsWithCIFunction · 0.85
stringFunction · 0.85
ReadFileFunction · 0.50
c_strMethod · 0.45
sizeMethod · 0.45
IsDirectoryMethod · 0.45
findMethod · 0.45
substrMethod · 0.45
dataMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected