RustDedicated/fixup-csproj.fish
2025-12-05 19:10:39 +10:30

28 lines
No EOL
866 B
Fish
Executable file

#!/bin/fish
for directory in */
set -l csproj_path "$directory$(string replace --regex '/$' '' $directory).csproj"
echo "$csproj_path"
if test ! -e $csproj_path
echo "Failed to find $csproj_path"
continue
end
set -l csproj "$(cat $csproj_path)"
set -l csproj "$(string replace --all --regex \
' <Reference Include="(.*)">\n <HintPath>.*</HintPath>\n </Reference>' \
' <ProjectReference Include="../$1/$1.csproj" />' \
$csproj \
)"
set -l csproj "$(string replace --all --regex \
' <TargetFramework>[\w\d\.]+</TargetFramework>' \
' <TargetFramework>net48</TargetFramework>' \
$csproj \
)"
# echo -e "$csproj" > "$(string replace --regex '/$' '' $directory).csproj"
echo -e "$csproj" > $csproj_path
end