Skip to content

Commit

Permalink
Use separate path for dev and prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ioedeveloper committed Oct 29, 2024
1 parent d6a0c2d commit bbf6fe6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
12 changes: 11 additions & 1 deletion apps/circuit-compiler/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function App() {
signalInputs = (signalInputs || []).filter(input => input)
dispatch({ type: 'SET_SIGNAL_INPUTS', payload: signalInputs })
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: null })
})
plugin.internalEvents.on('circuit_compiling_errored', compilerErrored)

Expand All @@ -61,7 +62,16 @@ function App() {
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
dispatch({ type: 'SET_COMPUTE_FEEDBACK', payload: null })
})
plugin.internalEvents.on('circuit_computing_witness_errored', compilerErrored)
plugin.internalEvents.on('circuit_computing_witness_errored', (err) => {
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
try {
const report = JSON.parse(err.message)

dispatch({ type: 'SET_COMPUTE_FEEDBACK', payload: report })
} catch (e) {
dispatch({ type: 'SET_COMPUTE_FEEDBACK', payload: err.message })
}
})

// parsing events
plugin.internalEvents.on('circuit_parsing_done', (_, filePathToId) => {
Expand Down
15 changes: 11 additions & 4 deletions apps/remixdesktop/src/plugins/circomElectronBasePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@ class CircomElectronPluginClient extends ElectronBasePluginClient {
if (!this.isCircomInstalled) await this.install(version)
// @ts-ignore
const wd = await this.call('fs', 'getWorkingDir')
const binDir = path.normalize(path.join(extractParentFromKey(filePath), '.bin'))
const binDir = path.join(wd, path.join(extractParentFromKey(filePath), '.bin'))
// @ts-ignore
const outputDirExists = await this.call('fs', 'exists', binDir)
const outputDirExists = await this.call('fs', 'exists', path.join(extractParentFromKey(filePath), '.bin'))
// @ts-ignore
if (!outputDirExists) await this.call('fs', 'mkdir', binDir)
if (!outputDirExists) await this.call('fs', 'mkdir', path.join(extractParentFromKey(filePath), '.bin'))
else {
// @ts-ignore
if (process.platform === 'win32' && 'wasm' in options) {
// @ts-ignore
await this.call('fs', 'rmdir', path.join(extractParentFromKey(filePath), '.bin', 'simple_js'))
}
}
filePath = path.join(wd, filePath)
const depPath = path.normalize(path.join(wd, '.deps/https/raw.githubusercontent.com/iden3/'))
const depPath = path.join(wd, '.deps/https/raw.githubusercontent.com/iden3/')
const outputDir = process.platform !== 'win32' ? path.join(extractParentFromKey(filePath), '.bin') : binDir

this.call('terminal' as any, 'logHtml', `Compiling ${filePath} with circom compiler (${version})`)
Expand Down
12 changes: 6 additions & 6 deletions apps/remixdesktop/src/tools/circom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ async function downloadFile(url: string, dest: string) {
export function getInstallationPath(version) {
switch (process.platform) {
case 'win32':
return path.join(app.getPath('temp'), 'circom-download', version, 'circom-windows-amd64.exe')
return process.env.NODE_ENV === 'production' ? path.join(app.getPath('temp'), 'circom-download', version, 'circom-windows-amd64.exe') : path.join(app.getAppPath(), 'circom-download', version, 'circom-windows-amd64.exe')

case 'darwin':
return path.join(app.getAppPath(), 'circom-download', version, 'circom-macos-amd64')
return process.env.NODE_ENV === 'production' ? path.join(app.getPath('temp'), 'circom-download', version, 'circom-macos-amd64') : path.join(app.getAppPath(), 'circom-download', version, 'circom-macos-amd64')

case 'linux':
return path.join(app.getAppPath(), 'circom-download', version, 'circom-linux-amd64')
return process.env.NODE_ENV === 'production' ? path.join(app.getPath('temp'), 'circom-download', version, 'circom-linux-amd64') : path.join(app.getAppPath(), 'circom-download', version, 'circom-linux-amd64')
}
}

Expand All @@ -61,13 +61,13 @@ export function getInstallationUrl(version) {
export function getLogInputSignalsPath() {
switch (process.platform) {
case 'win32':
return path.join(app.getPath('temp'), 'log_input_signals.txt')
return process.env.NODE_ENV === 'production' ? path.join(app.getPath('temp'), 'log_input_signals.txt') : path.join(app.getAppPath(), 'log_input_signals.txt')

case 'darwin':
return path.join(app.getAppPath(), 'log_input_signals.txt')
return process.env.NODE_ENV === 'production' ? path.join(app.getPath('temp'), 'log_input_signals.txt') : path.join(app.getAppPath(), 'log_input_signals.txt')

case 'linux':
return path.join(app.getAppPath(), 'log_input_signals.txt')
return process.env.NODE_ENV === 'production' ? path.join(app.getPath('temp'), 'log_input_signals.txt') : path.join(app.getAppPath(), 'log_input_signals.txt')
}
}

Expand Down

0 comments on commit bbf6fe6

Please sign in to comment.