Skip to content

Commit 91bc8d9

Browse files
committed
REXM: Remove duplicate entries on examples list on Update process
1 parent 7646d08 commit 91bc8d9

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

tools/rexm/rexm.c

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static void ClearExampleResources(char **resPaths);
168168

169169
// Add/remove VS project (.vcxproj) tofrom existing VS solution (.sln)
170170
static int AddVSProjectToSolution(const char *projFile, const char *slnFile, const char *category);
171-
//static int RemoveVSProjectFromSolution(const char *projFile, const char *slnFile, const char *category);
171+
static int RemoveVSProjectFromSolution(const char *projFile, const char *slnFile, const char *category);
172172

173173
// Generate unique UUID v4 string
174174
// Output format: {9A2F48CC-0DA8-47C0-884E-02E37F9BE6C1}
@@ -770,11 +770,8 @@ int main(int argc, char *argv[])
770770
FileRemove(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName));
771771

772772
// Edit: raylib/projects/VS2022/raylib.sln --> Remove example project
773-
//---------------------------------------------------------------------------
774-
// TODO: Remove project from solution
775-
//RemoveVSProjectFromSolution(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName),
776-
// TextFormat("%s/../projects/VS2022/raylib.sln", exBasePath));
777-
//---------------------------------------------------------------------------
773+
RemoveVSProjectFromSolution(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName),
774+
TextFormat("%s/../projects/VS2022/raylib.sln", exBasePath), exCategory);
778775

779776
// Remove: raylib.com/examples/<category>/<category>_example_name.html
780777
// Remove: raylib.com/examples/<category>/<category>_example_name.data
@@ -819,6 +816,22 @@ int main(int argc, char *argv[])
819816
int exListLen = (int)strlen(exList);
820817
strcpy(exListUpdated, exList);
821818

819+
// Copy examples list into an update list
820+
// NOTE: Checking and removing duplicate entries
821+
int lineCount = 0;
822+
char **exListLines = LoadTextLines(exList, &lineCount);
823+
int exListUpdatedOffset = 0;
824+
exListUpdatedOffset = sprintf(exListUpdated, "%s\n", exListLines[0]);
825+
826+
for (int i = 1; i < lineCount; i++)
827+
{
828+
if ((TextFindIndex(exListUpdated, exListLines[i]) == -1) || (exListLines[i][0] == '#'))
829+
exListUpdatedOffset += sprintf(exListUpdated + exListUpdatedOffset, "%s\n", exListLines[i]);
830+
else listUpdated = true;
831+
}
832+
833+
UnloadTextLines(exListLines);
834+
822835
for (unsigned int i = 0; i < list.count; i++)
823836
{
824837
if ((strcmp("examples_template", GetFileNameWithoutExt(list.paths[i])) != 0) && // HACK: Skip "examples_template"
@@ -859,8 +872,6 @@ int main(int argc, char *argv[])
859872
int exCollectionCount = 0;
860873
rlExampleInfo *exCollection = LoadExamplesData(exCollectionFilePath, "ALL", false, &exCollectionCount);
861874

862-
// TODO: Validate: Check duplicate entries in collection list?
863-
864875
// Set status information for all examples, using "status" field in the struct
865876
for (int i = 0; i < exCollectionCount; i++)
866877
{
@@ -2149,6 +2160,16 @@ static int AddVSProjectToSolution(const char *projFile, const char *slnFile, con
21492160
return result;
21502161
}
21512162

2163+
// Remove VS project (.vcxproj) to existing VS solution (.sln)
2164+
static int RemoveVSProjectFromSolution(const char *projFile, const char *slnFile, const char *category)
2165+
{
2166+
int result = 0;
2167+
2168+
// TODO: Remove project from solution file
2169+
2170+
return result;
2171+
}
2172+
21522173
// Generate unique UUID v4 string
21532174
// Output format: {9A2F48CC-0DA8-47C0-884E-02E37F9BE6C1}
21542175
static const char *GenerateUUIDv4(void)
@@ -2188,6 +2209,8 @@ static void UpdateSourceMetadata(const char *exSrcPath, const rlExampleInfo *inf
21882209
char exDescription[256] = { 0 }; // Example description: example text line #3
21892210
char exTitle[64] = { 0 }; // Example title: fileName without extension, replacing underscores by spaces
21902211

2212+
// TODO: Update source code metadata
2213+
21912214
// Update example header title (line #3 - ALWAYS)
21922215
// String: "* raylib [shaders] example - texture drawing"
21932216

@@ -2305,12 +2328,11 @@ static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath)
23052328
}
23062329
}
23072330

2308-
23092331
// Get text between two strings
23102332
// NOTE: Using static string to return result, MAX: 1024 bytes
23112333
static char *GetTextBetween(const char *text, const char *begin, const char *end)
23122334
{
2313-
#define MAX_TEXT_BETWEEN_SIZE 1024
2335+
#define MAX_TEXT_BETWEEN_SIZE 1024
23142336

23152337
static char between[MAX_TEXT_BETWEEN_SIZE] = { 0 };
23162338
memset(between, 0, MAX_TEXT_BETWEEN_SIZE);

0 commit comments

Comments
 (0)