diff options
author | F. Eugene Aumson <gene@aumson.org> | 2018-08-17 06:26:20 +0800 |
---|---|---|
committer | F. Eugene Aumson <gene@aumson.org> | 2018-08-17 06:26:20 +0800 |
commit | 445177bf420049041ade4d7526a5f4a8194bd216 (patch) | |
tree | 39f93ce8394f25c3432f326b9e734c5b9f1b4ccd /packages/sol-compiler/src/compiler.ts | |
parent | 402ca27fbf91f543addf0d4618e071ae10cfd70e (diff) | |
download | dexon-0x-contracts-445177bf420049041ade4d7526a5f4a8194bd216.tar.gz dexon-0x-contracts-445177bf420049041ade4d7526a5f4a8194bd216.tar.zst dexon-0x-contracts-445177bf420049041ade4d7526a5f4a8194bd216.zip |
move doesFileExist to fsWrapper
Diffstat (limited to 'packages/sol-compiler/src/compiler.ts')
-rw-r--r-- | packages/sol-compiler/src/compiler.ts | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index d3c4a3919..2e7120361 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -82,18 +82,6 @@ export class Compiler { private readonly _artifactsDir: string; private readonly _solcVersionIfExists: string | undefined; private readonly _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER; - private static async _doesFileExistAsync(filePath: string): Promise<boolean> { - try { - await fsWrapper.accessAsync( - filePath, - // node says we need to use bitwise, but tslint says no: - fs.constants.F_OK | fs.constants.R_OK, // tslint:disable-line:no-bitwise - ); - } catch (err) { - return false; - } - return true; - } private static async _getSolcAsync( solcVersion: string, ): Promise<{ solcInstance: solc.SolcInstance; fullSolcVersion: string }> { @@ -103,7 +91,7 @@ export class Compiler { } const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion); let solcjs: string; - if (await Compiler._doesFileExistAsync(compilerBinFilename)) { + if (await fsWrapper.doesFileExistAsync(compilerBinFilename)) { solcjs = (await fsWrapper.readFileAsync(compilerBinFilename)).toString(); } else { logUtils.log(`Downloading ${fullSolcVersion}...`); |