@@ -43,10 +43,11 @@ export const bundleIDToPath = bundleID => bundleID.replace(/\./g, '/');
4343export const decodeXmlEntities = name => decode ( name , { level : 'xml' } ) ;
4444export const encodeXmlEntities = name =>
4545 encode ( name , { mode : 'nonAscii' , level : 'xml' , numeric : 'hexadecimal' } ) ;
46+ const normalizePath = process . platform === 'win32' ? require ( 'normalize-path' ) : p => p ;
4647const androidValuesStringsFullPath = path . join ( APP_PATH , androidValuesStrings ) ;
4748
4849export const validateCreation = ( ) => {
49- const iosInfoPlistFullPath = globbySync ( path . join ( APP_PATH , iosPlist ) ) [ 0 ] ;
50+ const iosInfoPlistFullPath = globbySync ( normalizePath ( path . join ( APP_PATH , iosPlist ) ) ) [ 0 ] ;
5051 const fileExists =
5152 fs . existsSync ( iosInfoPlistFullPath ) && fs . existsSync ( androidValuesStringsFullPath ) ;
5253
@@ -139,7 +140,7 @@ const getElementFromXml = ({ filepath, selector }) => {
139140} ;
140141
141142export const getIosCurrentName = ( ) => {
142- const filepath = globbySync ( path . join ( APP_PATH , iosPlist ) ) [ 0 ] ;
143+ const filepath = globbySync ( normalizePath ( path . join ( APP_PATH , iosPlist ) ) ) [ 0 ] ;
143144 const selector = 'dict > key:contains("CFBundleDisplayName") + string' ;
144145 const element = getElementFromXml ( { filepath, selector } ) ;
145146
@@ -167,7 +168,7 @@ export const getAndroidCurrentBundleID = () => {
167168 * @returns {string } The name of the xcode project folder
168169 */
169170export const getIosXcodeProjectPathName = ( ) => {
170- const xcodeProjectPath = globbySync ( path . join ( APP_PATH , iosXcodeproj ) , {
171+ const xcodeProjectPath = globbySync ( normalizePath ( path . join ( APP_PATH , iosXcodeproj ) ) , {
171172 onlyDirectories : true ,
172173 } ) ;
173174
@@ -300,7 +301,7 @@ const updateElementInXml = async ({ filepath, selector, text }) => {
300301
301302export const updateIosNameInInfoPlist = async newName => {
302303 await updateElementInXml ( {
303- filepath : globbySync ( path . join ( APP_PATH , iosPlist ) ) [ 0 ] ,
304+ filepath : globbySync ( normalizePath ( path . join ( APP_PATH , iosPlist ) ) ) [ 0 ] ,
304305 selector : 'dict > key:contains("CFBundleDisplayName") + string' ,
305306 text : newName ,
306307 } ) ;
@@ -319,9 +320,9 @@ export const renameAndroidBundleIDFolders = async ({
319320 newBundleIDAsPath,
320321} ) => {
321322 const currentBundleIDFoldersRelativePaths = globbySync (
322- path . join ( APP_PATH , `${ androidJava } / ${ currentBundleIDAsPath } ` ) ,
323+ normalizePath ( path . join ( APP_PATH , `${ androidJava } ` ) ) ,
323324 { onlyDirectories : true }
324- ) . map ( folderPath => toRelativePath ( folderPath ) ) ;
325+ ) . map ( folderPath => normalizePath ( toRelativePath ( ` ${ folderPath } / ${ currentBundleIDAsPath } ` ) ) ) ;
325326
326327 await renameFoldersAndFiles ( {
327328 foldersAndFilesPaths : currentBundleIDFoldersRelativePaths ,
@@ -417,12 +418,15 @@ ${chalk.green('SUCCESS! 🎉 🎉 🎉')} Your app has been renamed to "${chalk.
417418 chalk . yellow ( `- Make sure to check old .xcodeproj and .xcworkspace in ios folder, please delete them manually.
418419- Please make sure to run "npx pod-install" and "watchman watch-del-all" before running the app.
419420
420- If you like this tool, please give it a star on GitHub: https://github.com/junedomingo/react-native-rename` )
421+ If you like this tool, please give it a star on GitHub: https://github.com/junedomingo/react-native-rename
422+
423+ ` )
421424 ) ;
422425} ;
423426
424427export const gitStageChanges = ( ) => {
425428 shell . cd ( APP_PATH ) ;
429+ shell . exec ( 'git config --local core.autocrlf false' ) ;
426430 shell . exec ( 'git add .' ) ;
427431} ;
428432
0 commit comments