mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-03 02:18:27 +00:00
perf(dotnet): fail faster in the dotnet module (#1034)
This commit is contained in:
parent
b3cc7b4016
commit
55503bb77b
@ -19,11 +19,20 @@ const PROJECT_JSON_FILE: &str = "project.json";
|
|||||||
/// the current directory:
|
/// the current directory:
|
||||||
/// global.json, project.json, *.sln, *.csproj, *.fsproj, *.xproj
|
/// global.json, project.json, *.sln, *.csproj, *.fsproj, *.xproj
|
||||||
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||||
let dotnet_files = get_local_dotnet_files(context).ok()?;
|
// First check if this is a DotNet Project before doing the O(n)
|
||||||
if dotnet_files.is_empty() {
|
// check for the version using the JSON files
|
||||||
|
let is_dotnet_project = context
|
||||||
|
.try_begin_scan()?
|
||||||
|
.set_files(&[GLOBAL_JSON_FILE, PROJECT_JSON_FILE])
|
||||||
|
.set_extensions(&["sln", "csproj", "fsproj", "xproj"])
|
||||||
|
.is_match();
|
||||||
|
|
||||||
|
if !is_dotnet_project {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let dotnet_files = get_local_dotnet_files(context).ok()?;
|
||||||
|
|
||||||
let mut module = context.new_module("dotnet");
|
let mut module = context.new_module("dotnet");
|
||||||
let config = DotnetConfig::try_load(module.config);
|
let config = DotnetConfig::try_load(module.config);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user