downloadsmenu.cpp: Ensure parent directories
Some checks failed
/ build (pull_request) Has been cancelled

Cars are downloaded to cars/models/<carname>, and tracks to
tracks/<category>/<trackname>. Therefore, downloadsmenu.cpp must ensure
cars/models/ and tracks/<category>/ exist before extracting the package.
This commit is contained in:
Xavier Del Campo Romero 2025-01-19 06:59:11 +01:00
parent a61ecdfad4
commit 553f77515d
Signed by: xavi
GPG key ID: 84FF3612A9BF43F2

View file

@ -635,9 +635,10 @@ int DownloadsMenu::save(entry *e, const std::string &path,
std::string &error) const std::string &error) const
{ {
const Asset &a = e->a; const Asset &a = e->a;
std::string dir = a.basedir() + a.path();
if (check_hash(e, path, error) if (check_hash(e, path, error)
|| GfDirCreate(a.path().c_str()) != GF_DIR_CREATED || GfDirCreate(dir.c_str()) != GF_DIR_CREATED
|| extract(e, path, error)) || extract(e, path, error))
goto failure; goto failure;
else else