Skip to content

Commit

Permalink
[feat-76] fixed issue where copying dll files to non-existent folder …
Browse files Browse the repository at this point in the history
…path
  • Loading branch information
silentrald committed Dec 8, 2024
1 parent c978d46 commit aec9dd0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/services/mods/bs-mods-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { deleteFolder, pathExist, Progression, unlinkPath } from "../../helpers/
import { lastValueFrom, Observable } from "rxjs";
import recursiveReadDir from "recursive-readdir";
import { sToMs } from "../../../shared/helpers/time.helpers";
import { copyFile, pathExistsSync } from "fs-extra";
import { copyFile, ensureDir, pathExistsSync } from "fs-extra";
import { CustomError } from "shared/models/exceptions/custom-error.class";
import { popElement } from "shared/helpers/array.helpers";
import { LinuxService } from "../linux.service";
Expand Down Expand Up @@ -325,9 +325,13 @@ export class BsModsManagerService {
const extensionName = path.extname(modPath).toLowerCase();

if (extensionName === ".dll") {
log.info("Copying", `${modPath}`, "to", `"${destination}"`);
const filename = path.basename(modPath, ".dll");
const copied = await copyFile(modPath, path.join(destination, filename))
const filename = path.basename(modPath);
// Defaultly copy the ".dll" to the "IPA/Pending/Plugins" folder
const fileFolder = path.join(destination, ModsInstallFolder.PLUGINS);

log.info("Copying", `${modPath}`, "to", `"${fileFolder}"`);
await ensureDir(fileFolder);
const copied = await copyFile(modPath, path.join(fileFolder, filename))
.then(() => true)
.catch(error => {
log.warn("Could not copy", `"${modPath}"`, error);
Expand Down Expand Up @@ -397,7 +401,6 @@ export class BsModsManagerService {
if (modFiles.length > 0) {
++modsInstalledCount;
modFilesCount += modFiles.length;
log.info(modFiles);

externalMod.name = path.basename(modPath, path.extname(modPath));
externalMod.files = modFiles;
Expand Down

0 comments on commit aec9dd0

Please sign in to comment.