Skip to content

Commit bc35591

Browse files
Merge pull request #14 from Rarst/check-target-directory-normalize-paths
Normalized paths before comparison
2 parents 482f2bf + 82bd429 commit bc35591

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Scaffold_Command.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -792,16 +792,14 @@ private function check_target_directory( $type, $target_dir ) {
792792
$target_dir = realpath( $target_dir );
793793
}
794794

795-
$parent_dir = dirname( $target_dir );
795+
$parent_dir = str_replace( '\\', '/', dirname( $target_dir ) );
796796

797-
if ( "theme" === $type ) {
798-
if ( WP_CONTENT_DIR . '/themes' === $parent_dir ) {
799-
return true;
800-
}
801-
} elseif ( "plugin" === $type ) {
802-
if ( WP_PLUGIN_DIR === $parent_dir ) {
803-
return true;
804-
}
797+
if ( 'theme' === $type && str_replace( '\\', '/', WP_CONTENT_DIR . '/themes' ) === $parent_dir ) {
798+
return true;
799+
}
800+
801+
if ( 'plugin' === $type && str_replace( '\\', '/', WP_PLUGIN_DIR ) === $parent_dir ) {
802+
return true;
805803
}
806804

807805
return false;

0 commit comments

Comments
 (0)