summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl <slxxls92@gmail.com>2016-10-29 12:13:40 +0100
committerGitHub <noreply@github.com>2016-10-29 12:13:40 +0100
commitda9ab98cb1850dd1748f9da91358806dc3c6b57a (patch)
tree0b46dfcff507135155a585853fc83aff6565db1a
parentbe1c1c98147e63e1f13f9367cdb7e99842fe8496 (diff)
parent4042ca4b163008d5120ba247abc8f1655da32d55 (diff)
downloadSMAPI-da9ab98cb1850dd1748f9da91358806dc3c6b57a.tar.gz
SMAPI-da9ab98cb1850dd1748f9da91358806dc3c6b57a.tar.bz2
SMAPI-da9ab98cb1850dd1748f9da91358806dc3c6b57a.zip
Merge pull request #152 from Pathoschild/mod/detect-game-path
Detect game path automatically (#126)
-rw-r--r--src/StardewModdingAPI/StardewModdingAPI.csproj51
-rw-r--r--src/TrainerMod/TrainerMod.csproj35
2 files changed, 35 insertions, 51 deletions
diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj
index 70502361..487bd952 100644
--- a/src/StardewModdingAPI/StardewModdingAPI.csproj
+++ b/src/StardewModdingAPI/StardewModdingAPI.csproj
@@ -11,18 +11,8 @@
<AssemblyName>StardewModdingAPI</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
- <SccProjectName>
- </SccProjectName>
- <SccLocalPath>
- </SccLocalPath>
- <SccAuxPath>
- </SccAuxPath>
- <SccProvider>
- </SccProvider>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
- <NuGetPackageImportStamp>
- </NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -38,18 +28,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
- <Choose>
- <When Condition="'$(SteamInstallPath)' != ''">
- <PropertyGroup>
- <SteamPath>$(SteamInstallPath)</SteamPath>
- </PropertyGroup>
- </When>
- <Otherwise>
- <PropertyGroup>
- <SteamPath>..\</SteamPath>
- </PropertyGroup>
- </Otherwise>
- </Choose>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
@@ -100,6 +78,18 @@
<PropertyGroup>
<StartupObject>StardewModdingAPI.Program</StartupObject>
</PropertyGroup>
+ <PropertyGroup>
+ <!-- Linux paths -->
+ <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/GOG Games/Stardew Valley/game</GamePath>
+ <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/.local/share/Steam/steamapps/common/Stardew Valley</GamePath>
+
+ <!-- Mac paths -->
+ <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS</GamePath>
+
+ <!-- Windows paths -->
+ <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath>
+ <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
@@ -119,7 +109,7 @@
</Reference>
<Reference Include="Stardew Valley, Version=1.0.5905.5747, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
- <HintPath>$(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
+ <HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
@@ -133,7 +123,7 @@
<Reference Include="System.Xml" />
<Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
- <HintPath>$(SteamPath)\steamapps\common\Stardew Valley\xTile.dll</HintPath>
+ <HintPath>$(GamePath)\xTile.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@@ -210,11 +200,8 @@
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
</Target>
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
+ <Target Name="BeforeBuild">
+ <!-- if game path is invalid, show one user-friendly error instead of a slew of reference errors -->
+ <Error Condition="!Exists('$(GamePath)')" Text="Failed to find the game install path automatically; edit the *.csproj file and manually add a &lt;GamePath&gt; setting with the full directory path containing the Stardew Valley executable." />
+ </Target>
+</Project>
diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj
index cc195e2a..a6955c68 100644
--- a/src/TrainerMod/TrainerMod.csproj
+++ b/src/TrainerMod/TrainerMod.csproj
@@ -40,18 +40,18 @@
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
- <Choose>
- <When Condition="'$(SteamInstallPath)' != ''">
- <PropertyGroup>
- <SteamPath>$(SteamInstallPath)</SteamPath>
- </PropertyGroup>
- </When>
- <Otherwise>
- <PropertyGroup>
- <SteamPath>..\</SteamPath>
- </PropertyGroup>
- </Otherwise>
- </Choose>
+ <PropertyGroup>
+ <!-- Linux paths -->
+ <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/GOG Games/Stardew Valley/game</GamePath>
+ <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/.local/share/Steam/steamapps/common/Stardew Valley</GamePath>
+
+ <!-- Mac paths -->
+ <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS</GamePath>
+
+ <!-- Windows paths -->
+ <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath>
+ <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
@@ -64,7 +64,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Stardew Valley">
- <HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
+ <HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -75,7 +75,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xTile">
- <HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\xTile.dll</HintPath>
+ <HintPath>$(GamePath)\xTile.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -103,11 +103,8 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
+ <!-- if game path is invalid, show one user-friendly error instead of a slew of reference errors -->
+ <Error Condition="!Exists('$(GamePath)')" Text="Failed to find the game install path automatically; edit the *.csproj file and manually add a &lt;GamePath&gt; setting with the full directory path containing the Stardew Valley executable." />
</Target>
- <Target Name="AfterBuild">
- </Target>
- -->
</Project> \ No newline at end of file