mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-20 15:17:50 +00:00
More std::strings.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
@@ -138,7 +138,7 @@ void CPropertySheetHelper::SetSlot5(SS_CARDTYPE NewCardType)
|
||||
std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE, TCHAR* FILEMASKS)
|
||||
{
|
||||
static char PathToFile[MAX_PATH] = {0}; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1.
|
||||
strcpy(PathToFile, Snapshot_GetFilename()); //RAPCS, line 2.
|
||||
strcpy(PathToFile, Snapshot_GetFilename().c_str()); //RAPCS, line 2.
|
||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||
TCHAR szFilename[MAX_PATH];
|
||||
RegLoadString(TEXT("Configuration"), REGVALUE, 1, szFilename, MAX_PATH, TEXT(""));
|
||||
@@ -195,53 +195,55 @@ void CPropertySheetHelper::SaveStateUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::GetDiskBaseNameWithAWS(TCHAR* pszFilename)
|
||||
void CPropertySheetHelper::GetDiskBaseNameWithAWS(std::string & pszFilename)
|
||||
{
|
||||
LPCTSTR pDiskName = sg_Disk2Card.GetBaseName(DRIVE_1);
|
||||
if (pDiskName && pDiskName[0])
|
||||
const std::string & pDiskName = sg_Disk2Card.GetBaseName(DRIVE_1);
|
||||
if (!pDiskName.empty())
|
||||
{
|
||||
strcpy(pszFilename, pDiskName);
|
||||
strcpy(&pszFilename[strlen(pDiskName)], ".aws.yaml");
|
||||
pszFilename = pDiskName + ".aws.yaml";
|
||||
}
|
||||
}
|
||||
|
||||
// NB. OK'ing this property sheet will call Snapshot_SetFilename() with this new filename
|
||||
int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave)
|
||||
{
|
||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||
TCHAR szFilename[MAX_PATH] = {0};
|
||||
std::string szDirectory;
|
||||
std::string szFilename;
|
||||
|
||||
if (bSave)
|
||||
{
|
||||
// Attempt to use drive1's image name as the name for the .aws file
|
||||
// Else Attempt to use the Prop Sheet's filename
|
||||
GetDiskBaseNameWithAWS(szFilename);
|
||||
if (szFilename[0] == 0)
|
||||
if (szFilename.empty())
|
||||
{
|
||||
strcpy(szFilename, Snapshot_GetFilename());
|
||||
szFilename = Snapshot_GetFilename();
|
||||
}
|
||||
}
|
||||
else // Load (or Browse)
|
||||
{
|
||||
// Attempt to use the Prop Sheet's filename first
|
||||
// Else attempt to use drive1's image name as the name for the .aws file
|
||||
strcpy(szFilename, Snapshot_GetFilename());
|
||||
if (szFilename[0] == 0)
|
||||
szFilename = Snapshot_GetFilename();
|
||||
if (szFilename.empty())
|
||||
{
|
||||
GetDiskBaseNameWithAWS(szFilename);
|
||||
}
|
||||
|
||||
strcpy(szDirectory, Snapshot_GetPath());
|
||||
szDirectory = Snapshot_GetPath();
|
||||
}
|
||||
|
||||
if (szDirectory[0] == 0)
|
||||
strcpy(szDirectory, g_sCurrentDir);
|
||||
if (szDirectory.empty())
|
||||
szDirectory = g_sCurrentDir;
|
||||
|
||||
//
|
||||
|
||||
OPENFILENAME ofn;
|
||||
ZeroMemory(&ofn,sizeof(OPENFILENAME));
|
||||
|
||||
TCHAR localFilename[MAX_PATH];
|
||||
strcpy(localFilename, szFilename.c_str());
|
||||
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = hWindow;
|
||||
ofn.hInstance = g_hInstance;
|
||||
@@ -255,9 +257,9 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
|
||||
ofn.lpstrFilter = TEXT("Save State files (*.aws,*.aws.yaml)\0*.aws;*.aws.yaml\0");
|
||||
TEXT("All Files\0*.*\0");
|
||||
}
|
||||
ofn.lpstrFile = szFilename; // Dialog strips the last .EXT from this string (eg. file.aws.yaml is displayed as: file.aws
|
||||
ofn.lpstrFile = localFilename; // Dialog strips the last .EXT from this string (eg. file.aws.yaml is displayed as: file.aws
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = szDirectory;
|
||||
ofn.lpstrInitialDir = szDirectory.c_str();
|
||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
ofn.lpstrTitle = pszTitle;
|
||||
|
||||
@@ -298,11 +300,11 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
|
||||
}
|
||||
|
||||
strcpy(m_szSSNewFilename, &szFilename[ofn.nFileOffset]);
|
||||
strcpy(m_szSSNewPathname, szFilename);
|
||||
strcpy(m_szSSNewPathname, szFilename.c_str());
|
||||
|
||||
szFilename[ofn.nFileOffset] = 0;
|
||||
if (_tcsicmp(szDirectory, szFilename))
|
||||
strcpy(m_szSSNewDirectory, szFilename);
|
||||
if (_tcsicmp(szDirectory.c_str(), szFilename.c_str()))
|
||||
strcpy(m_szSSNewDirectory, szFilename.c_str());
|
||||
}
|
||||
|
||||
m_bSSNewFilename = nRes ? true : false;
|
||||
|
||||
Reference in New Issue
Block a user