Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit22fc400

Browse files
Tomás Hernándezlonglho
Tomás Hernández
authored andcommitted
Fix root when the user uses symlinks (#106)
1 parentdb81343 commit22fc400

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/index.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,19 @@ export default function ({types: t}) {
217217
if(opts.messagesDir&&descriptors.length>0){
218218
// Make sure the relative path is "absolute" before
219219
// joining it with the `messagesDir`.
220-
constrelativePath=p.join(
220+
letrelativePath=p.join(
221221
p.sep,
222222
p.relative(process.cwd(),filename)
223223
);
224+
// Solve when the window user has symlink on the directory, because
225+
// process.cwd on windows returns the symlink root,
226+
// and filename (from babel) returns the original root
227+
if(process.platform==='win32'){
228+
const{ name}=p.parse(process.cwd());
229+
if(relativePath.includes(name)){
230+
relativePath=relativePath.slice(relativePath.indexOf(name)+name.length);
231+
}
232+
}
224233

225234
constmessagesFilename=p.join(
226235
opts.messagesDir,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp