-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.steam.props
More file actions
124 lines (105 loc) · 6.31 KB
/
.steam.props
File metadata and controls
124 lines (105 loc) · 6.31 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
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Steam Path Setup -->
<PropertyGroup>
<!-- On Windows: attempt to get the Steam install location from the registry -->
<_SteamRegPath>HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Valve\Steam</_SteamRegPath>
<SteamInstallPathFromRegistry Condition="'$(OS)' == 'Windows_NT'">$([MSBuild]::GetRegistryValueFromView('$(_SteamRegPath)', 'InstallPath', null, RegistryView.Registry32))</SteamInstallPathFromRegistry>
<!-- Use the registry value if available -->
<SteamDir Condition="'$(OS)' == 'Windows_NT' and '$(SteamInstallPathFromRegistry)' != ''">
$([MSBuild]::NormalizePath('$(SteamInstallPathFromRegistry)', 'steamapps'))
</SteamDir>
<!-- Default for Windows if registry lookup fails -->
<SteamDir Condition="'$(OS)' == 'Windows_NT' and '$(SteamInstallPathFromRegistry)' == ''">
$([MSBuild]::NormalizePath('C:', 'Program Files (x86)', 'Steam', 'steamapps'))
</SteamDir>
<!-- Default for non-Windows -->
<SteamDir Condition="'$(OS)' != 'Windows_NT'">$(HOME)/.steam/steam/steamapps</SteamDir>
<!-- Haste's App ID -->
<HasteAppId>1796470</HasteAppId>
<HarmonyWorkshopId>3408901301</HarmonyWorkshopId>
<EnableHarmonyWorkshop Condition="'$(EnableHarmonyWorkshop)'==''">false</EnableHarmonyWorkshop>
</PropertyGroup>
<!-- Compute the path to the libraryfolders.vdf file -->
<PropertyGroup>
<CleanSteamDir>$([System.Text.RegularExpressions.Regex]::Replace('$(SteamDir)', '^\s+|\s+$', ''))</CleanSteamDir>
<LibraryFoldersFile>$([MSBuild]::NormalizePath('$(CleanSteamDir)', 'libraryfolders.vdf'))</LibraryFoldersFile>
</PropertyGroup>
<!-- Settings that don't depend on file contents -->
<PropertyGroup>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<GenerateDependencyFile>false</GenerateDependencyFile>
</PropertyGroup>
<!-- Target to extract and set the Steam library paths -->
<Target Name="ProcessSteamLibraryPaths" BeforeTargets="ResolveAssemblyReferences">
<!-- Read the libraryfolders.vdf file -->
<ReadLinesFromFile File="$(LibraryFoldersFile)" Condition="Exists('$(LibraryFoldersFile)')">
<Output TaskParameter="Lines" PropertyName="LibraryFileContent" />
</ReadLinesFromFile>
<!-- Extract the Steam library path that contains Haste -->
<PropertyGroup>
<!-- Look for the section with the HasteAppId and extract the path -->
<LibraryPathMatch>$([System.Text.RegularExpressions.Regex]::Match('$(LibraryFileContent)', '.*"path"\s+"([^"]+)".*"$(HasteAppId)"\s+').Groups[1].Value)</LibraryPathMatch>
<!-- If we found a match, use it; otherwise try to extract any path -->
<SteamLibraryPath Condition="'$(LibraryPathMatch)' != ''">$(LibraryPathMatch)</SteamLibraryPath>
<SteamLibraryPath Condition="'$(LibraryPathMatch)' == ''">$([System.Text.RegularExpressions.Regex]::Match('$(LibraryFileContent)', '.*"path"\s+"([^"]+)"').Groups[1].Value)</SteamLibraryPath>
<!-- Set HasteDir and Managed DLLs path -->
<HasteDir>$([MSBuild]::NormalizePath('$(SteamLibraryPath)', 'steamapps', 'common', 'Haste'))</HasteDir>
<HasteManagedDir>$([MSBuild]::NormalizePath('$(HasteDir)', 'Haste_Data', 'Managed'))</HasteManagedDir>
<WorkshopDir>$([MSBuild]::NormalizePath('$(SteamLibraryPath)', 'steamapps', 'workshop', 'content', '$(HasteAppId)'))</WorkshopDir>
<HarmonyWorkshopDir>$([MSBuild]::NormalizePath('$(WorkshopDir)', '$(HarmonyWorkshopId)', '0Harmony.dll'))</HarmonyWorkshopDir>
</PropertyGroup>
<Message Importance="high" Text="Extracted SteamLibraryPath: [$(SteamLibraryPath)]" />
<Message Importance="high" Text="HasteDir: [$(HasteDir)]" />
<Message Importance="high" Text="HasteManagedDir: [$(HasteManagedDir)]" />
<Message Importance="high" Text="EnableHarmonyWorkshop: [$(EnableHarmonyWorkshop)]" />
<Message
Importance="high"
Text="Harmony: [$(HarmonyWorkshopDir)]"
Condition="'$(EnableHarmonyWorkshop)'=='true'" />
<!-- Add references for Haste Managed DLLs -->
<ItemGroup Condition="Exists('$(HasteManagedDir)')">
<Reference Include="$(HasteManagedDir)/*.dll" Private="false" />
</ItemGroup>
<!-- Conditionally add references for the Harmony workshop item -->
<ItemGroup
Condition="'$(EnableHarmonyWorkshop)'=='true' and Exists('$(WorkshopDir)')">
<Reference Include="$(HarmonyWorkshopDir)" Private="false" />
</ItemGroup>
<!-- These items are output for debugging purposes -->
<CreateItem
Include="$(HasteManagedDir)/*.dll"
Condition="Exists('$(HasteManagedDir)')">
<Output TaskParameter="Include" ItemName="HasteDllReferences" />
</CreateItem>
<CreateItem
Include="$(WorkshopDir)/*/*.dll"
Condition="'$(EnableHarmonyWorkshop)'=='true' and Exists('$(WorkshopDir)')">
<Output TaskParameter="Include" ItemName="WorkshopDllReferences" />
</CreateItem>
</Target>
<!-- Debug target for inspecting file contents and properties -->
<Target Name="DebugSteamProperties" DependsOnTargets="ProcessSteamLibraryPaths">
<Message Importance="high" Text="=== DebugSteamProperties ===" />
<Message Importance="high" Text="SteamInstallPathFromRegistry: [$(SteamInstallPathFromRegistry)]" />
<Message Importance="high" Text="SteamDir: [$(SteamDir)]" />
<Message Importance="high" Text="CleanSteamDir: [$(CleanSteamDir)]" />
<Message Importance="high" Text="LibraryFoldersFile: [$(LibraryFoldersFile)]" />
<Message Importance="high" Text="LibraryFileContent: [$(LibraryFileContent)]" />
<Message Importance="high" Text="SteamLibraryPath: [$(SteamLibraryPath)]" />
<Message Importance="high" Text="WorkshopDir: [$(WorkshopDir)]" />
<Message Importance="high" Text="EnableHarmonyWorkshop: [$(EnableHarmonyWorkshop)]" />
<Message
Importance="high"
Text="HarmonyWorkshopDir: [$(HarmonyWorkshopDir)]"
Condition="'$(EnableHarmonyWorkshop)'=='true'" />
<!-- Debug lists of DLLs (if needed) -->
<!-- <Message -->
<!-- Importance="high" -->
<!-- Text="Found Haste DLLs: @(HasteDllReferences->'%(FullPath)', ', ')" /> -->
<!-- <Message -->
<!-- Importance="high" -->
<!-- Text="Found Workshop DLLs: @(WorkshopDllReferences->'%(FullPath)', ', ')" -->
<!-- Condition="'$(EnableHarmonyWorkshop)'=='true'" /> -->
</Target>
</Project>