mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 03:01:47 -07:00
Updates to docs and scripts
This commit is contained in:
20
scripts/helpers/misc.psm1
Normal file
20
scripts/helpers/misc.psm1
Normal file
@ -0,0 +1,20 @@
|
||||
function Get-ScriptRepoRoot {
|
||||
$currentPath = $PSScriptRoot
|
||||
while ($currentPath -ne $null -and $currentPath -ne "")
|
||||
{
|
||||
if (Test-Path (Join-Path $currentPath ".git")) {
|
||||
return $currentPath
|
||||
}
|
||||
# Also check for .git file which indicates a submodule
|
||||
$gitFile = Join-Path $currentPath ".git"
|
||||
if (Test-Path $gitFile -PathType Leaf)
|
||||
{
|
||||
$gitContent = Get-Content $gitFile
|
||||
if ($gitContent -match "gitdir: (.+)") {
|
||||
return $currentPath
|
||||
}
|
||||
}
|
||||
$currentPath = Split-Path $currentPath -Parent
|
||||
}
|
||||
throw "Unable to find repository root"
|
||||
}
|
Reference in New Issue
Block a user