Skip to content

Commit

Permalink
Fix for Windows - Backslashes is the escape
Browse files Browse the repository at this point in the history
Fix for Windows Backslashes is the escape character and will result in an invalid path in settings.gradle
  [issue:23176]( facebook/react-native#23176)
  i found this fix in past commit (0.57) and i submit again.

Changelog:
----------

[Android] [Fixed] - Fix for Windows Backslashes is the escape character and will result in an invalid path in settings.gradle

Test Plan:
----------

in windows run react-native link and start error,  Backslashes is the escape character and will result in an invalid path in settings.gradle
  • Loading branch information
misaku authored Jan 28, 2019
1 parent fa3ae49 commit 06be19a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/cli/src/link/android/patches/makeSettingsPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
const path = require('path');
const normalizeProjectName = require('./normalizeProjectName');

const isWin = process.platform === 'win32';

module.exports = function makeSettingsPatch(
name,
androidConfig,
Expand All @@ -20,7 +22,15 @@ module.exports = function makeSettingsPatch(
androidConfig.sourceDir
);
const normalizedProjectName = normalizeProjectName(name);

/*
* Fix for Windows
* Backslashes is the escape character and will result in
* an invalid path in settings.gradle
* https://github.com/facebook/react-native/issues/23176
*/
if (isWin) {
projectDir = projectDir.replace(/\\/g, '/');
}
return {
pattern: '\n',
patch:
Expand Down

0 comments on commit 06be19a

Please sign in to comment.