Skip to content

Commit

Permalink
wip: working on windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ex3ndr committed Mar 8, 2023
1 parent ec0fa63 commit 2bc528e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion scripts/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { consoleLogger } from '../src/logger';
console.log('Processing ' + p.path + r);
let c: FuncCompilationResult;
try {
let stdlibPath = path.resolve(__dirname, '../src/stdlib/stdlib.fc');
let stdlibPath = path.resolve(__dirname, '..', 'stdlib', 'stdlib.fc');
let stdlib = fs.readFileSync(stdlibPath, 'utf-8');
let code = fs.readFileSync(p.path + r, 'utf-8');
c = await funcCompile({
Expand All @@ -78,6 +78,7 @@ import { consoleLogger } from '../src/logger';
continue;
}
} catch (e) {
console.warn(e);
console.warn('Failed');
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function run(args: { configPath: string, projectNames?: string[] })
// Compile
let success = true;
let project = createNodeFileSystem(rootPath, false);
let stdlib = path.resolve(__dirname, '..', 'stdlib') + path.sep; // Improves developer experience
let stdlib = createNodeFileSystem(path.resolve(__dirname, '..', 'stdlib'), false); // Improves developer experience
for (let config of projects) {
console.log('💼 Compiling project ' + config.name + '...');
let built = await build({ config, project, stdlib, logger: consoleLogger });
Expand Down
4 changes: 2 additions & 2 deletions src/pipeline/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ const version = require('../../package.json').version;
export async function build(args: {
config: ConfigProject,
project: VirtualFileSystem,
stdlib: string,
stdlib: string | VirtualFileSystem,
logger?: TactLogger | null | undefined
}) {

const { config, project } = args;
const stdlib = createVirtualFileSystem(args.stdlib, files);
const stdlib = (typeof args.stdlib === 'string') ? createVirtualFileSystem(args.stdlib, files) : args.stdlib;
const logger: TactLogger = args.logger || consoleLogger;

// Configure context
Expand Down
3 changes: 3 additions & 0 deletions src/vfs/createVirtualFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { VirtualFileSystem } from "./VirtualFileSystem";

export function createVirtualFileSystem(root: string, fs: { [key: string]: string }, readonly: boolean = true): VirtualFileSystem {
let normalizedRoot = normalize(root);
if (!normalizedRoot.endsWith('/')) {
normalizedRoot += '/';
}
return {
root: normalizedRoot,
exists(filePath: string): boolean {
Expand Down

0 comments on commit 2bc528e

Please sign in to comment.