diff --git a/assets.php b/assets.php index 9dfb619..061f5e8 100644 --- a/assets.php +++ b/assets.php @@ -2,7 +2,7 @@ /** * Plugin Name: Assets * Description: Asset library with a plugin bootstrap file for automated testing. - * Version: 1.2.6 + * Version: 1.2.8 * Author: StellarWP * Author URI: https://stellarwp.com */ diff --git a/src/Assets/Config.php b/src/Assets/Config.php index 64308bd..291188f 100644 --- a/src/Assets/Config.php +++ b/src/Assets/Config.php @@ -131,7 +131,13 @@ public static function set_relative_asset_path( string $path ) { * @return void */ public static function set_path( string $path ) { - $plugins_content_dir_position = strpos( $path, WP_PLUGIN_DIR ); + $plugin_dir = WP_PLUGIN_DIR; + + if ( DIRECTORY_SEPARATOR !== '/' ) { + $plugin_dir = str_replace( '/', DIRECTORY_SEPARATOR, $plugin_dir ); + } + + $plugins_content_dir_position = strpos( $path, $plugin_dir ); $themes_content_dir_position = strpos( $path, get_theme_root() ); if ( @@ -139,7 +145,7 @@ public static function set_path( string $path ) { && $themes_content_dir_position === false ) { // Default to plugins. - $path = WP_PLUGIN_DIR . $path; + $path = $plugin_dir . $path; } elseif ( $plugins_content_dir_position !== false ) { $path = substr( $path, $plugins_content_dir_position ); } elseif ( $themes_content_dir_position !== false ) {