mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Don't partially delete house when overwriting the current house
This commit is contained in:
@@ -48,6 +48,9 @@ Boolean CheckFileError (short resultCode, const PLPasStr &fileName)
|
|||||||
case PLErrors::kOutOfMemory:
|
case PLErrors::kOutOfMemory:
|
||||||
stringIndex = 7;
|
stringIndex = 7;
|
||||||
break;
|
break;
|
||||||
|
case PLErrors::kFileIsBusy:
|
||||||
|
stringIndex = 12;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
stringIndex = 1;
|
stringIndex = 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "House.h"
|
#include "House.h"
|
||||||
#include "MacFileInfo.h"
|
#include "MacFileInfo.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
|
#include "PLStringCompare.h"
|
||||||
#include "PLTimeTaggedVOSEvent.h"
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
@@ -32,6 +33,7 @@ void UpdateGoToDialog (Dialog *);
|
|||||||
int16_t GoToFilter (void *context, Dialog *dial, const TimeTaggedVOSEvent *evt);
|
int16_t GoToFilter (void *context, Dialog *dial, const TimeTaggedVOSEvent *evt);
|
||||||
|
|
||||||
extern PortabilityLayer::IResourceArchive *houseResFork;
|
extern PortabilityLayer::IResourceArchive *houseResFork;
|
||||||
|
extern PortabilityLayer::CompositeFile *houseCFile;
|
||||||
|
|
||||||
|
|
||||||
houseHand thisHouse;
|
houseHand thisHouse;
|
||||||
@@ -115,7 +117,14 @@ Boolean CreateNewHouse (void)
|
|||||||
theSpec.m_name[0] = static_cast<uint8_t>(savePathLength);
|
theSpec.m_name[0] = static_cast<uint8_t>(savePathLength);
|
||||||
memcpy(theSpec.m_name + 1, savePath, savePathLength);
|
memcpy(theSpec.m_name + 1, savePath, savePathLength);
|
||||||
|
|
||||||
if (fm->FileExists(theSpec.m_dir, theSpec.m_name))
|
// Don't try to overwrite the current house - The GPF will probably be locked anyway
|
||||||
|
if (houseCFile && theSpec.m_dir == houseCFile->GetDirectory() && !StrCmp::CompareCaseInsensitive(theSpec.m_name, houseCFile->GetFileName()))
|
||||||
|
{
|
||||||
|
CheckFileError(PLErrors::kFileIsBusy, theSpec.m_name);
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fm->CompositeFileExists(theSpec.m_dir, theSpec.m_name))
|
||||||
{
|
{
|
||||||
if (!fm->DeleteCompositeFile(theSpec.m_dir, theSpec.m_name))
|
if (!fm->DeleteCompositeFile(theSpec.m_dir, theSpec.m_name))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace PLErrors
|
|||||||
kBadFileName,
|
kBadFileName,
|
||||||
kFileNotFound,
|
kFileNotFound,
|
||||||
kAccessDenied,
|
kAccessDenied,
|
||||||
|
kFileIsBusy,
|
||||||
|
|
||||||
kOutOfMemory,
|
kOutOfMemory,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user