WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 160db5e

Browse files
authored
Merge pull request #67 from mizdra/fix-root-dir
`rootDir` should be unix-style path with `unixStylePath: true`
2 parents 105e1d0 + f4ea4e9 commit 160db5e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/index.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,17 @@ describe('createIFF', () => {
184184

185185
describe('CreateIFFResult', () => {
186186
const createIFF = defineIFFCreator({ generateRootDir: () => fixtureDir });
187-
test('rootDir', async () => {
188-
const createIFF = defineIFFCreator({ generateRootDir: () => join(fixtureDir, 'a') });
189-
const iff = await createIFF({});
190-
expect(iff.rootDir).toBe(join(fixtureDir, 'a'));
187+
describe('rootDir', () => {
188+
test('basic', async () => {
189+
const createIFF = defineIFFCreator({ generateRootDir: () => join(fixtureDir, 'a') });
190+
const iff = await createIFF({});
191+
expect(iff.rootDir).toBe(join(fixtureDir, 'a'));
192+
});
193+
test('unixStylePath', async () => {
194+
const createIFF = defineIFFCreator({ generateRootDir: () => fixtureDir, unixStylePath: true });
195+
const iff = await createIFF({});
196+
expect(iff.rootDir).toBe(slash(fixtureDir));
197+
});
191198
});
192199
describe('paths', () => {
193200
test('basic', async () => {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export function defineIFFCreator(defineIFFCreatorOptions: DefineIFFCreatorOption
264264
} as FlattenDirectory<MergeDirectory<U, T>>;
265265

266266
const iff: CreateIFFResult<MergeDirectory<U, T>> = {
267-
rootDir,
267+
rootDir: unixStylePath ? slash(rootDir) : rootDir,
268268
paths,
269269
join(...paths) {
270270
return unixStylePath ? slash(join(rootDir, ...paths)) : join(rootDir, ...paths);

0 commit comments

Comments
 (0)