Clean up user data vs. game data

FossilOrigin-Name: d751d8b0b7ca39f458acf12116633d5ebdae0976c8241cf419b49510990f3268
This commit is contained in:
Jonathan Schleifer 2025-03-09 00:39:50 +00:00
parent 2cd917c394
commit 095af0a1e7
4 changed files with 28 additions and 21 deletions

View file

@ -338,13 +338,15 @@ complete(OFString *s_)
}
bool
execfile(OFString *cfgfile)
execfile(OFIRI *cfgfile)
{
@autoreleasepool {
OFString *command;
@try {
command = [OFString stringWithContentsOfFile:cfgfile];
} @catch (id e) {
command = [OFString stringWithContentsOfIRI:cfgfile];
} @catch (OFOpenItemFailedException *e) {
return false;
} @catch (OFReadFailedException *e) {
return false;
}
@ -356,10 +358,12 @@ execfile(OFString *cfgfile)
void
exec(OFString *cfgfile)
{
if (!execfile(cfgfile)) {
@autoreleasepool {
@autoreleasepool {
if (!execfile([Cube.sharedInstance.userDataIRI
IRIByAppendingPathComponent:cfgfile]) &&
!execfile([Cube.sharedInstance.gameDataIRI
IRIByAppendingPathComponent:cfgfile]))
conoutf(@"could not read \"%@\"", cfgfile);
}
}
}