Skip to content

Commit

Permalink
feat: windows support
Browse files Browse the repository at this point in the history
Since the root dir looks different in Windows and Unix (`C:\\` vs `/`), use crossplatform way of getting it

Closes: meza#251
  • Loading branch information
Den-dp authored Mar 1, 2024
1 parent a76a0a9 commit 3282eba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { constants } from 'fs';
import path from 'path';

export const workingDir = () => process.cwd();
const rootDir = path.parse(process.cwd()).root;

const findTopLevelDir = async (dir: string): Promise<string> => {
try {
await fs.access(path.join(dir, '.adr-dir'), constants.F_OK);
return dir;
} catch (e) {
if (dir === '/') {
if (dir === rootDir) {
throw new Error('No ADR directory config found');
}
const newDir = path.join(dir, '..');
Expand Down

0 comments on commit 3282eba

Please sign in to comment.