@@ -13,6 +13,9 @@ int32 UProjectVersionFromGitBPLibrary::Major = 0;
1313int32 UProjectVersionFromGitBPLibrary::Minor = 0 ;
1414int32 UProjectVersionFromGitBPLibrary::Patch = 0 ;
1515
16+ FString UProjectVersionFromGitBPLibrary::SectionName = FString(TEXT(" VersionInfo" ));
17+ FString UProjectVersionFromGitBPLibrary::VersionFileIni = FString(TEXT(" Version.ini" ));
18+
1619FString UProjectVersionFromGitBPLibrary::GitStdOutput = FString(TEXT(" " ));
1720
1821DEFINE_LOG_CATEGORY (ProjectVersionFromGit)
@@ -40,7 +43,7 @@ bool UProjectVersionFromGitBPLibrary::ExecProcess(const TCHAR* URL, const TCHAR*
4043
4144FText UProjectVersionFromGitBPLibrary::GetProjectVersion ()
4245{
43- static const FString DefaultGameIni = FString::Printf (TEXT (" %sDefaultGame.ini " ), *FPaths::SourceConfigDir ());
46+ static const FString VersionFileIniPath = FString::Printf (TEXT (" %s%s " ), *FPaths::SourceConfigDir (), *VersionFileIni );
4447
4548 if (GEngine->IsEditor ())
4649 {
@@ -55,7 +58,7 @@ FText UProjectVersionFromGitBPLibrary::GetProjectVersion()
5558
5659 TagNameArg = FString (TEXT (" describe --tags " )) + OutStdOut.TrimStartAndEnd ();
5760 ExecProcess (TEXT (" git" ), *TagNameArg, &OutReturnCode, &OutStdOut, &OutStdErr, *OptionalWorkingDirectory);
58- UE_LOG (ProjectVersionFromGit, Log, TEXT (" -------- Git tag: %s" ), *OutStdOut);
61+ // UE_LOG(ProjectVersionFromGit, Log, TEXT("-------- Git tag: %s"), *OutStdOut);
5962
6063 const FRegexPattern myPattern (TEXT (" ([0-9]\\ .[0-9]\\ .[0-9])+" ));
6164 FRegexMatcher myMatcher (myPattern, OutStdOut);
@@ -67,7 +70,7 @@ FText UProjectVersionFromGitBPLibrary::GetProjectVersion()
6770 // UE_LOG(ProjectVersionFromGit, Log, TEXT("Regex git tag pos: %i %i"), beginPos, endPos);
6871 OutStdOut = OutStdOut.Mid (beginPos, endPos - beginPos);
6972 }
70- UE_LOG (ProjectVersionFromGit, Log, TEXT (" -------- After regex git tag: %s" ), *OutStdOut);
73+ UE_LOG (ProjectVersionFromGit, Log, TEXT (" -------- Git tag: %s" ), *OutStdOut);
7174
7275 if (OutStdOut.IsEmpty ())
7376 {
@@ -104,121 +107,121 @@ FText UProjectVersionFromGitBPLibrary::GetProjectVersion()
104107
105108 if (!GitStdOutput.IsEmpty ())
106109 {
107- UE_LOG (ProjectVersionFromGit, Warning, TEXT (" -------- git status --short: %s" ), *GitStdOutput);
110+ UE_LOG (ProjectVersionFromGit, Warning, TEXT (" -------- Git status --short: %s" ), *GitStdOutput);
108111 }
109112
110113 GConfig->SetText (
111- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
114+ *SectionName ,
112115 TEXT (" ProjectVersion" ),
113116 ProjectVersion,
114- DefaultGameIni
117+ VersionFileIniPath
115118 );
116119
117120 GConfig->SetInt (
118- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
121+ *SectionName ,
119122 TEXT (" Major" ),
120123 Major,
121- DefaultGameIni
124+ VersionFileIniPath
122125 );
123126
124127 GConfig->SetInt (
125- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
128+ *SectionName ,
126129 TEXT (" Minor" ),
127130 Minor,
128- DefaultGameIni
131+ VersionFileIniPath
129132 );
130133
131134 GConfig->SetInt (
132- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
135+ *SectionName ,
133136 TEXT (" Patch" ),
134137 Patch,
135- DefaultGameIni
138+ VersionFileIniPath
136139 );
137140
138141 GConfig->SetText (
139- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
142+ *SectionName ,
140143 TEXT (" BranchName" ),
141144 BranchName,
142- DefaultGameIni
145+ VersionFileIniPath
143146 );
144147
145148 GConfig->SetText (
146- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
149+ *SectionName ,
147150 TEXT (" CommitHash" ),
148151 CommitHash,
149- DefaultGameIni
152+ VersionFileIniPath
150153 );
151154
152155 GConfig->SetText (
153- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
156+ *SectionName ,
154157 TEXT (" DateTimeBuild" ),
155158 DateTimeBuild,
156- DefaultGameIni
159+ VersionFileIniPath
157160 );
158161
159162 GConfig->SetText (
160- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
163+ *SectionName ,
161164 TEXT (" ProjectVersionFormatAll" ),
162165 ProjectVersionFormatAll,
163- DefaultGameIni
166+ VersionFileIniPath
164167 );
165168 }
166169 else
167170 {
168171 GConfig->GetText (
169- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
172+ *SectionName ,
170173 TEXT (" ProjectVersion" ),
171174 ProjectVersion,
172- GGameIni
175+ VersionFileIniPath
173176 );
174177
175178 GConfig->GetInt (
176- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
179+ *SectionName ,
177180 TEXT (" Major" ),
178181 Major,
179- GGameIni
182+ VersionFileIniPath
180183 );
181184
182185 GConfig->GetInt (
183- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
186+ *SectionName ,
184187 TEXT (" Minor" ),
185188 Minor,
186- GGameIni
189+ VersionFileIniPath
187190 );
188191
189192 GConfig->GetInt (
190- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
193+ *SectionName ,
191194 TEXT (" Patch" ),
192195 Patch,
193- GGameIni
196+ VersionFileIniPath
194197 );
195198
196199 GConfig->GetText (
197- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
200+ *SectionName ,
198201 TEXT (" BranchName" ),
199202 BranchName,
200- GGameIni
203+ VersionFileIniPath
201204 );
202205
203206 GConfig->GetText (
204- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
207+ *SectionName ,
205208 TEXT (" CommitHash" ),
206209 CommitHash,
207- GGameIni
210+ VersionFileIniPath
208211 );
209212
210213 GConfig->GetText (
211- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
214+ *SectionName ,
212215 TEXT (" DateTimeBuild" ),
213216 DateTimeBuild,
214- GGameIni
217+ VersionFileIniPath
215218 );
216219
217220 GConfig->GetText (
218- TEXT ( " /Script/EngineSettings.GeneralProjectSettings " ) ,
221+ *SectionName ,
219222 TEXT (" ProjectVersionFormatAll" ),
220223 ProjectVersionFormatAll,
221- GGameIni
224+ VersionFileIniPath
222225 );
223226 }
224227
@@ -231,7 +234,7 @@ FText UProjectVersionFromGitBPLibrary::GetProjectVersion()
231234 UE_LOG (ProjectVersionFromGit, Log, TEXT (" -------- DateTimeBuild: %s" ), *DateTimeBuild.ToString ());
232235 UE_LOG (ProjectVersionFromGit, Log, TEXT (" -------- ProjectVersionFormatAll: %s" ), *ProjectVersionFormatAll.ToString ());
233236 // UE_LOG(ProjectVersionFromGit, Log, TEXT("-------- GGameIni: %s"), *GGameIni);
234- // UE_LOG(ProjectVersionFromGit, Log, TEXT("-------- DefaultGameIni : %s"), *DefaultGameIni );
237+ // UE_LOG(ProjectVersionFromGit, Log, TEXT("-------- VersionFileIniPath : %s"), *VersionFileIniPath );
235238
236239 return ProjectVersion;
237240}
0 commit comments