diff --git a/app/ConvDiskOptionsDialog.cpp b/app/ConvDiskOptionsDialog.cpp index 5e05f58..27cbef2 100644 --- a/app/ConvDiskOptionsDialog.cpp +++ b/app/ConvDiskOptionsDialog.cpp @@ -248,6 +248,10 @@ void ConvDiskOptionsDialog::OnCompute(void) } else { /* * Set up the progress window as a modal dialog. + * + * TODO: there's a weird issue where this un-modals the conversion + * options dialog. While this is running, and after it finishes, + * you can use menu items and perform other actions. Noted on Win7. */ GenericArchive::XferStatus result; diff --git a/app/DiskArchive.cpp b/app/DiskArchive.cpp index 4c1906d..35edafd 100644 --- a/app/DiskArchive.cpp +++ b/app/DiskArchive.cpp @@ -1399,7 +1399,7 @@ NuResult DiskArchive::HandleReplaceExisting(const A2File* pExisting, ConfirmOverwriteDialog confOvwr; - confOvwr.fExistingFile = pExisting->GetPathName(); + confOvwr.fExistingFile = Charset::ConvertMORToUNI(pExisting->GetPathName()); confOvwr.fExistingFileModWhen = pExisting->GetModWhen(); PathName srcPath(pDetails->GetLocalPathName()); @@ -1596,7 +1596,7 @@ CString DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) /* really ought to do this separately for each thread */ SET_PROGRESS_BEGIN(); - CString pathNameW(parms.pathName); + CString pathNameW(Charset::ConvertMORToUNI(parms.pathName)); SET_PROGRESS_UPDATE2(0, pDetails->GetLocalPathName(), pathNameW); DIError dierr; @@ -1604,8 +1604,8 @@ CString DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) rsrcBuf, rsrcLen); SET_PROGRESS_END(); if (dierr != kDIErrNone) { - errMsg.Format(L"Unable to add '%hs' to image: %hs.", - parms.pathName, DiskImgLib::DIStrError(dierr)); + errMsg.Format(L"Unable to add '%ls' to image: %hs.", + (LPCWSTR) pathNameW, DiskImgLib::DIStrError(dierr)); goto bail; } delete[] dataBuf; @@ -2070,24 +2070,24 @@ bool DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry, DIError dierr; A2File* pNewFile = NULL; DiskFS::CreateParms parms; - CStringA pathName; + CStringA pathNameMOR; time_t now = time(NULL); /* * Create the full path. */ if (pFile->IsVolumeDirectory()) { - pathName = newName; + pathNameMOR = newName; } else { - pathName = pParentEntry->GetPathNameMOR(); - pathName += pParentEntry->GetFssep(); - pathName += newName; + pathNameMOR = pParentEntry->GetPathNameMOR(); + pathNameMOR += pParentEntry->GetFssep(); + pathNameMOR += newName; } ASSERT(wcschr(newName, pParentEntry->GetFssep()) == NULL); /* using NufxLib constants; they match with ProDOS */ memset(&parms, 0, sizeof(parms)); - parms.pathName = pathName; + parms.pathName = pathNameMOR; parms.fssep = pParentEntry->GetFssep(); parms.storageType = kNuStorageDirectory; parms.fileType = 0x0f; // ProDOS DIR diff --git a/app/FileNameConv.cpp b/app/FileNameConv.cpp index 427bf50..f6e9487 100644 --- a/app/FileNameConv.cpp +++ b/app/FileNameConv.cpp @@ -609,6 +609,45 @@ static const struct { * =========================================================================== */ +void PathProposal::Init(GenericEntry* pEntry) +{ + // TODO(Unicode) + //fStoredPathName = Charset::ConvertMORToUNI(pEntry->GetPathNameMOR()); + // can't do this yet -- the rest of the extraction path isn't ready + fStoredPathName = pEntry->GetPathNameMOR(); + fStoredFssep = pEntry->GetFssep(); + //if (fStoredFssep == '\0') // e.g. embedded DOS 3.3 volume + // fStoredFssep = kDefaultStoredFssep; + fFileType = pEntry->GetFileType(); + fAuxType = pEntry->GetAuxType(); + //fThreadKind set from SelectionEntry + // reset the "output" fields + fLocalPathName = L":HOSED:"; + fLocalFssep = ']'; + // I expect these to be as-yet unset; check it + ASSERT(!fPreservation); + ASSERT(!fAddExtension); + ASSERT(!fJunkPaths); +} + +// init the "add to archive" side +void PathProposal::Init(const WCHAR* localPathName) { + //ASSERT(basePathName[strlen(basePathName)-1] != kLocalFssep); + //fLocalPathName = localPathName + strlen(basePathName)+1; + fLocalPathName = localPathName; + fLocalFssep = kLocalFssep; + // reset the "output" fields + fStoredPathName = L":HOSED:"; + fStoredFssep = '['; + fFileType = 0; + fAuxType = 0; + fThreadKind = GenericEntry::kDataThread; + // I expect these to be as-yet unset; check it + ASSERT(!fPreservation); + ASSERT(!fAddExtension); + ASSERT(!fJunkPaths); +} + void PathProposal::ArchiveToLocal(void) { WCHAR* pathBuf; diff --git a/app/FileNameConv.h b/app/FileNameConv.h index 29e1ff5..d853b44 100644 --- a/app/FileNameConv.h +++ b/app/FileNameConv.h @@ -5,6 +5,7 @@ */ /* * File name conversion. + * TODO: rename to PathProposal.h */ #ifndef APP_FILENAMECONV_H #define APP_FILENAMECONV_H @@ -42,41 +43,10 @@ public: virtual ~PathProposal(void) {} // init the "extract from archive" side from a GenericEntry struct - void Init(GenericEntry* pEntry) { - // TODO(Unicode): use Unicode/MOR conversion rather than CP-1252 - fStoredPathName = pEntry->GetPathNameMOR(); - fStoredFssep = pEntry->GetFssep(); - //if (fStoredFssep == '\0') // e.g. embedded DOS 3.3 volume - // fStoredFssep = kDefaultStoredFssep; - fFileType = pEntry->GetFileType(); - fAuxType = pEntry->GetAuxType(); - //fThreadKind set from SelectionEntry - // reset the "output" fields - fLocalPathName = L":HOSED:"; - fLocalFssep = ']'; - // I expect these to be as-yet unset; check it - ASSERT(!fPreservation); - ASSERT(!fAddExtension); - ASSERT(!fJunkPaths); - } + void Init(GenericEntry* pEntry); // init the "add to archive" side - void Init(const WCHAR* localPathName) { - //ASSERT(basePathName[strlen(basePathName)-1] != kLocalFssep); - //fLocalPathName = localPathName + strlen(basePathName)+1; - fLocalPathName = localPathName; - fLocalFssep = kLocalFssep; - // reset the "output" fields - fStoredPathName = L":HOSED:"; - fStoredFssep = '['; - fFileType = 0; - fAuxType = 0; - fThreadKind = GenericEntry::kDataThread; - // I expect these to be as-yet unset; check it - ASSERT(!fPreservation); - ASSERT(!fAddExtension); - ASSERT(!fJunkPaths); - } + void Init(const WCHAR* localPathName); /* * Convert a pathname pulled out of an archive to something suitable for the diff --git a/app/NufxArchive.cpp b/app/NufxArchive.cpp index 80c11bc..98cd1ad 100644 --- a/app/NufxArchive.cpp +++ b/app/NufxArchive.cpp @@ -14,6 +14,7 @@ #include "AddClashDialog.h" #include "Main.h" #include "../nufxlib/NufxLib.h" +#include "../reformat/Charset.h" /* * NufxLib doesn't currently allow an fssep of '\0', so we use this instead @@ -499,6 +500,7 @@ NuResult NufxArchive::NufxErrorMsgHandler(NuArchive*, void* vErrorMessage) (void) NuGetExtraData(pArchive, (void**) &pThis); ASSERT(pThis != NULL); + // TODO(Unicode): NufxLib should be handing us these in UTF-16 oldName = newName = NULL; if (pProgress->operation == kNuOpAdd) { oldName = pProgress->origPathnameUNI; @@ -522,10 +524,11 @@ NuResult NufxArchive::NufxErrorMsgHandler(NuArchive*, void* vErrorMessage) // oldName == NULL ? "(null)" : oldName, // newName == NULL ? "(null)" : newName); - //status = pMainWin->SetProgressUpdate(perc, oldName, newName); CString oldNameW(oldName); CString newNameW(newName); - status = SET_PROGRESS_UPDATE2(perc, oldNameW, newNameW); + status = SET_PROGRESS_UPDATE2(perc, + oldNameW.IsEmpty() ? NULL : (LPCWSTR) oldNameW, + newNameW.IsEmpty() ? NULL : (LPCWSTR) newNameW); /* check to see if user hit the "cancel" button on the progress dialog */ if (pProgress->state == kNuProgressAborted) { @@ -1313,8 +1316,7 @@ NuResult NufxArchive::HandleReplaceExisting(const NuErrorStatus* pErrorStatus) ConfirmOverwriteDialog confOvwr; PathName path(pErrorStatus->pathnameUNI); - // TODO(Unicode): convert MOR to Unicode - confOvwr.fExistingFile = pErrorStatus->pRecord->filenameMOR; + confOvwr.fExistingFile = Charset::ConvertMORToUNI(pErrorStatus->pRecord->filenameMOR); confOvwr.fExistingFileModWhen = DateTimeToSeconds(&pErrorStatus->pRecord->recModWhen); if (pErrorStatus->origPathname != NULL) {