Skip to content

Commit 0651e6f

Browse files
committed
gitignore: added private templates
1 parent e010891 commit 0651e6f

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Check if script is running as administrator, if not, relaunch as administrator
2+
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
3+
Write-Host "Script is not running as administrator. Relaunching with administrator privileges..."
4+
Start-Process powershell.exe -Verb RunAs -ArgumentList ("-File", $MyInvocation.MyCommand.Path)
5+
exit
6+
}
7+
8+
echo "Script root:"
9+
echo $PSScriptRoot
10+
11+
# Define source and destination directories
12+
$sourceDirectory = "$PSScriptRoot\..\private\.foam\templates"
13+
$destinationDirectory = "$PSScriptRoot\..\.foam\templates"
14+
15+
echo $sourceDirectory
16+
17+
echo $destinationDirectory
18+
19+
# Check if the source directory exists
20+
if (-not (Test-Path -Path $sourceDirectory -PathType Container)) {
21+
Write-Host "Source directory not found."
22+
exit
23+
}
24+
25+
# Check if the destination directory exists, if not, create it
26+
if (-not (Test-Path -Path $destinationDirectory -PathType Container)) {
27+
New-Item -Path $destinationDirectory -ItemType Directory -Force | Out-Null
28+
}
29+
30+
# Get all files in the source directory
31+
$files = Get-ChildItem -Path $sourceDirectory -File
32+
33+
# Loop through each file and create symlink in destination directory
34+
foreach ($file in $files) {
35+
$linkPath = Join-Path -Path $destinationDirectory -ChildPath $file.Name
36+
$targetPath = $file.FullName
37+
38+
# Check if symlink already exists
39+
if (-not (Test-Path -Path $linkPath -PathType Leaf)) {
40+
# Create symlink
41+
New-Item -ItemType SymbolicLink -Path $linkPath -Value $targetPath
42+
Write-Host "Symlink created for $($file.Name)"
43+
} else {
44+
Write-Host "Symlink already exists for $($file.Name)"
45+
}
46+
}
47+
48+
pause

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
out/
33
private
44
private/
5+
.foam/templates/*-private-note.md

0 commit comments

Comments
 (0)