Support Windows file paths
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3219157. --> Reported by: [agentrickard](https://www.drupal.org/user/20975) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Hi there. I'm trying to run this on a Windows laptop and it keeps throwing the following error for multiple modules I've tried:</p> <pre>Rector v0.7.29<br>Config file: C:/Windows/Temp/upgrade_rector/upgrade_rector.yml<br><br><br>In RobotLoader.php line 186:<br><br>&nbsp; Ambiguous class Drupal\action\ActionAddForm resolution; defined in E:/Web/A<br>&nbsp; mbient.Impact/Web/drupal/core\modules\action\src\ActionAddForm.php and in E<br>&nbsp; :/Web/Ambient.Impact/Web/drupal/core/modules\action\src\ActionAddForm.php.<br><br><br>process [-n|--dry-run] [-a|--autoload-file AUTOLOAD-FILE] [--match-git-diff] [-o|--output-format [OUTPUT-FORMAT]] [--no-progress-bar] [--output-file OUTPUT-FILE] [--cache-debug] [--clear-cache] [--] [&lt;source&gt;...]</pre><p>After some confusion about why it would list the same file with the exact same path twice, I noticed that there's a different slash in one compared to the other (core\modules versus core/modules), which leads me to believe it's got something to do with the backslashes used on Windows versus forward slashes on *nix systems and not normalizing that somehow.</p> <p>Edit: seems to be a known issue reported in upgrade_rector.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Use Windows.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Temporary fix is to update rector.yml (now rector.php) and switching the slashes. See some of the examples like <a href="https://github.com/palantirnet/drupal-rector/blob/master/rector-config-web-dir.yml">https://github.com/palantirnet/drupal-rector/blob/master/rector-config-web-dir.yml</a>.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>It would be great to have this fixed in drupal-rector itself if possible. Maybe paths could be run through realpath() or something similar so PHP can fix that for us</p>
issue