-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBetterKeybinds.csproj
More file actions
143 lines (118 loc) · 7.06 KB
/
Copy pathBetterKeybinds.csproj
File metadata and controls
143 lines (118 loc) · 7.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<LangVersion>latest</LangVersion>
<AssemblyName>BetterKeybinds</AssemblyName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>bin/$(Configuration)</OutputPath>
<!-- === Settings == -->
<!-- These are the only things you should be changing -->
<ImplicitManagedReferences>true</ImplicitManagedReferences>
<AutoCopyMod>true</AutoCopyMod>
<FallbackSteamPath>UnknownSteamPath</FallbackSteamPath>
<!-- =============== -->
</PropertyGroup>
<!-- OS Detection -->
<PropertyGroup>
<IsWindows>$([System.OperatingSystem]::IsWindows())</IsWindows>
<IsMacOS>$([System.OperatingSystem]::IsMacOS())</IsMacOS>
<IsLinux>$([System.OperatingSystem]::IsLinux())</IsLinux>
<OperatingSystem Condition="'$(IsWindows)' == 'true'">Windows</OperatingSystem>
<OperatingSystem Condition="'$(IsMacOS)' == 'true'">MacOS</OperatingSystem>
<OperatingSystem Condition="'$(IsLinux)' == 'true'">Linux</OperatingSystem>
</PropertyGroup>
<!-- User Profile Home Path -->
<PropertyGroup>
<!-- Credits to https://cazzulino.com for this! -->
<UserProfileHome Condition="'$([MSBuild]::IsOSUnixLike())' == 'true'">$(HOME)</UserProfileHome>
<UserProfileHome Condition="'$([MSBuild]::IsOSUnixLike())' != 'true'">$(USERPROFILE)</UserProfileHome>
</PropertyGroup>
<!-- Steam Path Resolution -->
<PropertyGroup>
<!-- 64 bit Windows path, note that registry paths must use backslashes -->
<DirtySteamPath Condition="$(IsWindows)">$([MSBuild]::GetRegistryValue(`HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Valve\Steam`, `InstallPath`))</DirtySteamPath>
<!-- 32 bit Windows path, note that registry paths must use backslashes -->
<DirtySteamPath Condition="'$(DirtySteamPath)' == '' And $(IsWindows)">$([MSBuild]::GetRegistryValue(`HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam`, `InstallPath`))</DirtySteamPath>
<!-- MacOS typical steam path -->
<DirtySteamPath Condition="'$(DirtySteamPath)' == '' And Exists('$(UserProfileHome)/Library/Application Support/Steam')">$(UserProfileHome)/Library/Application Support/Steam</DirtySteamPath>
<!-- Linux path 1 (Flatpak) -->
<DirtySteamPath Condition="'$(DirtySteamPath)' == '' And Exists('$(UserProfileHome)/.var/app/com.valvesoftware.Steam/.local/share/Steam/')">$(UserProfileHome)/.var/app/com.valvesoftware.Steam/.local/share/Steam</DirtySteamPath>
<!-- Linux path 2 (Native) -->
<DirtySteamPath Condition="'$(DirtySteamPath)' == '' And Exists('$(UserProfileHome)/.local/share/Steam')">$(UserProfileHome)/.local/share/Steam</DirtySteamPath>
<!-- Linux path 3 (Symlink) -->
<DirtySteamPath Condition="'$(DirtySteamPath)' == '' And Exists('$(UserProfileHome)/.steam/steam')">$(UserProfileHome)/.steam/steam</DirtySteamPath>
<ResolvedSteamPath Condition="'$(DirtySteamPath)' != ''">$(DirtySteamPath)</ResolvedSteamPath>
<ResolvedSteamPath Condition="'$(DirtySteamPath)' == ''">$(FallbackSteamPath)</ResolvedSteamPath>
<SteamPath>$([System.String]::Copy('$(ResolvedSteamPath)').Replace('\', '/'))</SteamPath>
</PropertyGroup>
<!-- Common Paths -->
<PropertyGroup>
<!-- SFS Path: Verified for Windows and MacOS, linux untested -->
<SFSPath>$(SteamPath)/steamapps/common/Spaceflight Simulator/Spaceflight Simulator Game</SFSPath>
<!-- MacOS does not have spaces -->
<SFSPath Condition="$(IsMacOS)">$(SteamPath)/steamapps/common/Spaceflight Simulator/SpaceflightSimulatorGame.app</SFSPath>
<!-- Managed Folder: Verified for Windows and MacOS, linux untested -->
<ManagedFolder>$(SFSPath)/Spaceflight Simulator_Data/Managed</ManagedFolder>
<!-- MacOS shenanigans -->
<ManagedFolder Condition="$(IsMacOS)">$(SFSPath)/Contents/Resources/Data/Managed</ManagedFolder>
<!-- Mods Folder: Verified for Windows and MacOS, linux untested -->
<ModsFolder>$(SFSPath)/Mods</ModsFolder>
</PropertyGroup>
<!-- Debugging logs -->
<Target Name="VerifyPaths" BeforeTargets="CoreCompile;PrepareForBuild">
<!-- OS -->
<Message Text="Operating System: $(OperatingSystem)" Importance="High" />
<Message Text="Steam path resolved to: $(SteamPath)" Importance="High" />
<Message Text="Spaceflight Simulator path resolved to: $(SFSPath)" Importance="High" />
<Message Text="Managed folder resolved to: $(ManagedFolder)" Importance="High" />
<Message Text="Mods folder resolved to: $(ModsFolder)" Importance="High" />
</Target>
<!-- Implicit Managed References -->
<ItemGroup>
<Reference
Include="$(ManagedFolder)/*.dll"
Exclude="$(ManagedFolder)/System.*.dll;
$(ManagedFolder)/System.dll;
$(ManagedFolder)/Firebase.*.dll;
$(ManagedFolder)/Unity.Tasks.dll;
$(ManagedFolder)/Unity.Compat.dll"
Condition="'$(ImplicitManagedReferences)' == 'true'">
<Private>false</Private>
</Reference>
<Reference Include="Assembly-CSharp.dll" Condition="'$(ImplicitManagedReferences)' == 'false'">
<HintPath>$(ManagedFolder)/Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.dll" Condition="'$(ImplicitManagedReferences)' == 'false'">
<HintPath>$(ManagedFolder)/UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule.dll" Condition="'$(ImplicitManagedReferences)' == 'false'">
<HintPath>$(ManagedFolder)/UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="0Harmony.dll" Condition="'$(ImplicitManagedReferences)' == 'false'">
<HintPath>$(ManagedFolder)/0Harmony.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- Mod References -->
<Reference Include="UITools" Condition="Exists('$(ModsFolder)/UITools')">
<HintPath>$(ModsFolder)/UITools/UITools.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<Target Name="VerifyInstallation" BeforeTargets="Build">
<Error
Condition="!Exists('$(ManagedFolder)')"
Text="
Spaceflight Simulator installation could not be found.
Edit FallbackSteamPath in the .csproj or install the game through Steam.
"
/>
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="Exists('$(SFSPath)') And '$(AutoCopyMod)' == 'true'">
<MakeDir Directories="$(ModsFolder)/$(AssemblyName)"
Condition="!Exists('$(ModsFolder)/$(AssemblyName)')" />
<Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFolder="$(ModsFolder)/$(AssemblyName)/" SkipUnchangedFiles="true"/>
</Target>
</Project>