Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/RisohEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8906,6 +8906,22 @@ BOOL MMainWnd::DoWriteRC(LPCWSTR pszFileName, LPCWSTR pszResH, const EntrySet& f
StringCchPrintfW(szMsg, _countof(szMsg), LoadStringDx(IDS_COPYHEADERFILE), textinclude1_w.c_str());
if (MsgBoxDx(szMsg, MB_ICONQUESTION | MB_YESNO) == IDYES)
{
// Create parent directory if it doesn't exist
// This handles paths like "include\resource.h" or "include/resource.h"
WCHAR szDestHeaderDir[MAX_PATH];
StringCchCopyW(szDestHeaderDir, _countof(szDestHeaderDir), szDestHeaderPath);
PathRemoveFileSpecW(szDestHeaderDir);
if (szDestHeaderDir[0] && !PathIsDirectoryW(szDestHeaderDir))
{
INT nResult = SHCreateDirectoryExW(NULL, szDestHeaderDir, NULL);
if (nResult != ERROR_SUCCESS && nResult != ERROR_ALREADY_EXISTS)
{
// Directory creation failed, show error to user
ErrorBoxDx(IDS_CANNOTSAVE);
// Continue to try CopyFileW anyway, which will also fail
}
}

if (!CopyFileW(szSrcHeaderPath, szDestHeaderPath, FALSE))
{
// Copy failed, show error to user
Expand Down