Opened 16 years ago

Closed 16 years ago

Last modified 6 years ago

#4003 closed defect (fixed)

FS: Cannot add a subfolder to a non-existing folder

Reported by: bluegr Owned by: lordhoto
Priority: normal Component: --Other--
Version: Keywords:
Cc: Game: Inherit the Earth

Description

Using the latest SVN version of ScummVM under Windows XP and Vista

SAGA games may have several subfolders where files are placed (depending on the game version)

After the latest changes to the filesystem, the following no longer works: Common::File::addDefaultDirectory(_gameDataDir.getChild("game").getChild("itedata"));

This attempts to add the directory game/itedata, but the directory "game" does not exist, so adding "itedata" right after that references a null object. It used to work before

I'm not sure if the relevant piece of code should be changed, or if there should be some kind of checking in the FS level. If someone tries to add a folder "foo/bar", and "foo" does not exist, shouldn't there be some sort of check to avoid crashes?

Ticket imported from: #2198456. Ticket imported from: bugs/4003.

Change History (4)

comment:1 by bluegr, 16 years ago

Changing the aforementioned line to: if (_gameDataDir.getChild("game").exists()) Common::File::addDefaultDirectory(_gameDataDir.getChild("game").getChild("itedata")); works

Is it a correct solution though?

comment:2 by lordhoto, 16 years ago

I fixed File::addDefaultDirectory to only process valid FSNode directory nodes. So it should not be needed to change ITE code. Of course we might consider defining on what's valid usage and what isn't, but I propose you should write to -devel about that rather than discussing it here.

comment:3 by lordhoto, 16 years ago

Owner: set to lordhoto
Resolution: fixed
Status: newclosed

comment:4 by digitall, 6 years ago

Component: --Unset----Other--
Game: Inherit the Earth
Note: See TracTickets for help on using tickets.