Skip to content

Commit 3b1c2b5

Browse files
Copilotkatahiromz
andcommitted
Address code review comments for TEXTINCLUDE 1 support
- Add comment explaining write-protect marker "< " convention from Visual C++ - Improve comment for res2/res1 selection logic with TN035 reference - Use !res2.empty() instead of res2.size() for clearer condition Co-authored-by: katahiromz <2107452+katahiromz@users.noreply.github.com>
1 parent 05d3c8a commit 3b1c2b5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/RisohEditor.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7830,6 +7830,8 @@ static MStringW GetTextInclude1HeaderFile(const EntrySet& res, LPCWSTR szRCPath)
78307830
}
78317831

78327832
// If empty or contains write protect marker, return empty
7833+
// Note: "< " prefix indicates the file is read-only (e.g., "< resource.h\0")
7834+
// This is a Visual C++ convention for write-protecting RC files
78337835
if (data.empty() || data.find("< ") != std::string::npos)
78347836
return L"";
78357837

@@ -7951,11 +7953,14 @@ BOOL MMainWnd::DoLoadRC(HWND hwnd, LPCWSTR szPath)
79517953

79527954
// Load resource.h based on TEXTINCLUDE 1
79537955
// Issue #301: Support TEXTINCLUDE 1
7956+
// TN035: TEXTINCLUDE 1 contains the resource symbol header file name
79547957
UnloadResourceH(hwnd);
79557958
if (g_settings.bAutoLoadNearbyResH)
79567959
{
79577960
// First, try to load the header file specified in TEXTINCLUDE 1
7958-
MStringW strHeaderFile = GetTextInclude1HeaderFile(res2.size() ? res2 : res1, szPath);
7961+
// Prefer res2 (loaded with APSTUDIO_INVOKED) as it contains TEXTINCLUDE resources
7962+
// Fall back to res1 if res2 is empty (e.g., when APSTUDIO_INVOKED loading failed)
7963+
MStringW strHeaderFile = GetTextInclude1HeaderFile(!res2.empty() ? res2 : res1, szPath);
79597964
if (!strHeaderFile.empty())
79607965
{
79617966
// Load the header file from TEXTINCLUDE 1 value

0 commit comments

Comments
 (0)