@@ -133,7 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
133133 $ jsonOutput = $ this ->isJsonOutput ($ input );
134134 $ processOutput = $ jsonOutput ? new BufferedOutput () : $ output ;
135135 $ target = (string ) $ input ->getOption ('target ' );
136- $ isDefaultWikiTarget = ProjectCapabilitiesResolverInterface:: DEFAULT_WIKI_TARGET === $ target ;
136+ $ isDefaultWikiTarget = $ this -> isDefaultWikiTarget ( $ target) ;
137137 $ cacheEnabled = $ this ->isCacheEnabled ($ input );
138138
139139 if ($ input ->getOption ('init ' )) {
@@ -213,6 +213,38 @@ protected function execute(InputInterface $input, OutputInterface $output): int
213213 );
214214 }
215215
216+ /**
217+ * Detects whether a target option still points at the default wiki target path.
218+ *
219+ * @param string $target the wiki target option received from the CLI
220+ *
221+ * @return bool true when the provided path is equivalent to the default wiki target
222+ */
223+ private function isDefaultWikiTarget (string $ target ): bool
224+ {
225+ return $ this ->normalizeProjectRelativePath ($ target ) === $ this ->normalizeProjectRelativePath (
226+ ProjectCapabilitiesResolverInterface::DEFAULT_WIKI_TARGET
227+ );
228+ }
229+
230+ /**
231+ * Normalizes a project-relative path for resilient default-option comparisons.
232+ *
233+ * @param string $path the project-relative path to normalize
234+ *
235+ * @return string the normalized project-relative path
236+ */
237+ private function normalizeProjectRelativePath (string $ path ): string
238+ {
239+ $ normalizedPath = str_replace ('\\' , '/ ' , $ path );
240+
241+ while (str_starts_with ($ normalizedPath , './ ' )) {
242+ $ normalizedPath = substr ($ normalizedPath , 2 );
243+ }
244+
245+ return rtrim ($ normalizedPath , '/ ' );
246+ }
247+
216248 /**
217249 * Adds the repository wiki as a Git submodule when the target path is missing.
218250 *
0 commit comments