blob: 86128023dc442f5e64692bce41bf2a4fb999e037 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import * as fs from 'fs';
import { ContractSource } from '../types';
import { Resolver } from './resolver';
export class FSResolver extends Resolver {
// tslint:disable-next-line:prefer-function-over-method
public resolveIfExists(importPath: string): ContractSource | undefined {
if (fs.existsSync(importPath) && fs.lstatSync(importPath).isFile()) {
const fileContent = fs.readFileSync(importPath).toString();
return { source: fileContent, path: importPath, absolutePath: importPath };
}
return undefined;
}
}
|