Skip to content

Commit

Permalink
Windows drive fix (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
JAPNITSINGH authored Jul 12, 2024
1 parent e41ec3c commit b6e4aa5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const CONFIG_TEMPLATE_NAME = 'infracost.yml.tmpl';
export const USAGE_FILE_NAME = 'infracost-usage.yml';

export function cleanFilename(filename: string): string {
const replaceC = /^\/C/g;
let cleaned = filename.replace(replaceC, '/c');
const replaceDrive = /^\/[A-Z]:/g;
let cleaned = filename.replace(replaceDrive, (match) => match.toLowerCase());

if (cleaned.startsWith('c')) {
if (cleaned.match(/^[a-z]:/)) {
const slash = /\\+/gi;
cleaned = `/${cleaned.replace(slash, '/')}`;
}
Expand Down

0 comments on commit b6e4aa5

Please sign in to comment.