Skip to content

Commit

Permalink
move ucp/.cache creation logic such that it is only called once simul…
Browse files Browse the repository at this point in the history
…taneously
  • Loading branch information
gynt committed Aug 26, 2024
1 parent 0c4fdcd commit e150980
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ export const downloadAndInstallContent = async (
const gameFolder = getStore().get(GAME_FOLDER_ATOM);

const cacheDir = `${gameFolder}/ucp/.cache/`;
if (!(await onFsExists(cacheDir))) {
LOGGER.msg(`.cache directory doesn't exist, creating it!`).warn();
await createDir(cacheDir);
}

const destination = `${cacheDir}${contentElement.definition.name}-${contentElement.definition.version}.zip`;

Expand Down Expand Up @@ -206,6 +202,14 @@ export const downloadContent = async (contentElements: ContentElement[]) => {
`Downloading: ${contentElements.map((ce) => ce.definition.name).join(', ')}`,
).debug();

const gameFolder = getStore().get(GAME_FOLDER_ATOM);

const cacheDir = `${gameFolder}/ucp/.cache/`;
if (!(await onFsExists(cacheDir))) {
LOGGER.msg(`.cache directory doesn't exist, creating it!`).warn();
await createDir(cacheDir);
}

const contentElementsWithoutPackageSource = contentElements.filter(
(ce) => ce.contents.package.length === 0,
);
Expand Down

0 comments on commit e150980

Please sign in to comment.