Skip to content

Commit

Permalink
Fixed copyFile API
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbl committed Jun 24, 2024
1 parent b5bcbcf commit 9095a3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/main/worker/InstallationRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'path';
import type { IBridgeAPI, IInstallModsOptions, Mod } from 'bridge/BridgeAPI';
import type { ConsoleAPI } from 'bridge/ConsoleAPI';
import { FileManager } from './FileManager';
Expand Down Expand Up @@ -36,17 +37,16 @@ export class InstallationRuntime {
return `${this.options.preExtractedDataPath}\\${filePath}`;
}

public getModSourceFilePath(filePath: string): string {
const appPath = this.BridgeAPI.getAppPath();
return `${appPath}\\mods\\${this.mod.id}\\${filePath}`;
public async getModSourceFilePath(filePath: string): Promise<string> {
const appPath = await this.BridgeAPI.getAppPath();
return path.join(appPath, 'mods', this.mod.id, filePath);
}

public getDestinationFilePath(filePath: string): string {
const suffix = filePath === '' ? '' : `\\${filePath}`;
if (this.options.isDirectMode) {
return `${this.options.dataPath}${suffix}`;
return path.join(this.options.dataPath, filePath);
}
return `${this.options.mergedPath}${suffix}`;
return path.join(this.options.mergedPath, filePath);
}

public getRelativeFilePathFromDestinationFilePath(filePath: string): string {
Expand Down
2 changes: 1 addition & 1 deletion src/main/worker/ModAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function getModAPI(runtime: InstallationRuntime): AsyncModAPI {
if (!runtime.options.isDryRun) {
const copiedFiles: CopiedFile[] = [];
await runtime.BridgeAPI.copyFile(
runtime.getModSourceFilePath(src),
await runtime.getModSourceFilePath(src),
runtime.getDestinationFilePath(dst),
overwrite,
copiedFiles,
Expand Down

0 comments on commit 9095a3b

Please sign in to comment.