Skip to content

Commit

Permalink
Fix rename logic for the cpp Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrom131 committed Nov 14, 2024
1 parent bf6a9b1 commit 7c5fc0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const CIRCOM_FILE_REG_EXP = /\w+\.circom/;
export const NODE_MODULES_REG_EXP = /^node_modules\//;
export const URI_SCHEME_REG_EXP = /([a-zA-Z]+):\/\//;

export const MAKEFILE_NAME = "Makefile";

export const CIRCUIT_ARTIFACTS_SUFFIX = "_artifacts.json";

export const COMPILER_AMD_REPOSITORY_URL = "https://github.com/iden3/circom/releases/download";
Expand Down
6 changes: 6 additions & 0 deletions src/utils/path-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import path from "path";

import { normalizeSourceName, localSourceNameToPath } from "hardhat/utils/source-names";

import { MAKEFILE_NAME } from "../constants";

import { FileFilterSettings } from "../types/zkit-config";

export function getNormalizedFullPath(projectRoot: string, dirPath: string): string {
Expand Down Expand Up @@ -48,6 +50,10 @@ export function renameFilesRecursively(dir: string, searchValue: string, replace
newEntryPath = path.join(dir, entry.name.replace(searchValue, replaceValue));

fs.renameSync(oldEntryPath, newEntryPath);
} else if (dir.endsWith("_cpp") && entry.name === MAKEFILE_NAME) {
const makefileContent: string = fs.readFileSync(oldEntryPath, "utf-8");

fs.writeFileSync(oldEntryPath, makefileContent.replaceAll(searchValue, replaceValue));
}

if (entry.isDirectory()) {
Expand Down

0 comments on commit 7c5fc0d

Please sign in to comment.