Skip to content

Commit 373016a

Browse files
author
ci-bot
committed
check file exist before emitting
1 parent b6470ed commit 373016a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

apps/remixdesktop/src/plugins/foundryPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ class FoundryPluginClient extends ElectronBasePluginRemixdClient {
119119
compilationTarget: null
120120
}
121121
compilationResult.inputSources.target = file
122+
console.log('Foundry compilation detected, emitting contract', file, path)
123+
if (!fs.existsSync(path)) return
122124
await this.readContract(path, compilationResult, cache)
123125
this.emit('compilationFinished', compilationResult.compilationTarget, { sources: compilationResult.input }, 'soljson', compilationResult.output, compilationResult.solcVersion)
124126
} catch (e) {
125127
console.log('Error emitting contract', e)
126128
}
127129
}
128130

129-
async readContract(contractFolder, compilationResultPart, cache) {
131+
async readContract(contractFolder, compilationResultPart, cache) {
130132
const files = await fs.promises.readdir(contractFolder)
131133
for (const file of files) {
132134
const path = join(contractFolder, file)

apps/remixdesktop/src/plugins/hardhatPlugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class HardhatPluginClient extends ElectronBasePluginRemixdClient {
101101

102102
private async emitContract(file: string) {
103103
const contractFilePath = join(this.buildPath, file)
104+
if (!fs.existsSync(contractFilePath)) return
104105
const stat = await fs.promises.stat(contractFilePath)
105106
if (!stat.isDirectory()) return
106107
const files = await fs.promises.readdir(contractFilePath)

0 commit comments

Comments
 (0)