Use separate path for dev and prod

circom-desktop
ioedeveloper 4 weeks ago
parent 2150ac0688
commit a1a8801d2c
  1. 12
      apps/circuit-compiler/src/app/app.tsx
  2. 15
      apps/remixdesktop/src/plugins/circomElectronBasePlugin.ts
  3. 12
      apps/remixdesktop/src/tools/circom.ts

@ -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)
@ -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) => {

@ -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})`)

@ -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')
}
}
@ -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')
}
}

Loading…
Cancel
Save