Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/Analysis/Problem/Bukkit/PluginProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,21 @@ protected function correctPluginPath(string $pluginPath): string
}

/**
* Extracts the plugin name without the file extension (usually .jar) from a plugin path
* Extracts the plugin name without the .jar file extension from a plugin path
*
* @param string $pluginPath
* @param string $pluginPath Can be a path to a plugin file or a plugin name
* @return string
*/
protected function extractPluginName(string $pluginPath): string
{
return pathinfo($pluginPath, PATHINFO_FILENAME);
$fileName = $this->extractPluginFileName($pluginPath);
// plugin names can contain a . (dot)
// when using pathinfo($pluginPath, PATHINFO_FILENAME) on a plugin name with a ., the wrong plugin name would be returned.
// since the file extension of a plugin is always .jar, we can simply remove it to get the plugin name from the file name.
if (str_ends_with($fileName, ".jar")) {
$fileName = substr($fileName, 0, -4);
}
return $fileName;
}

/**
Expand Down
Loading
Loading