Skip to content

Commit

Permalink
Fix AutoUpdate for self-builds, #586
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Jul 13, 2017
1 parent 6d22b19 commit db149d1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ArchiSteamFarm/ASF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ limitations under the License.
namespace ArchiSteamFarm {
internal static class ASF {
private const byte AutoUpdatePeriodInHours = 24;
private const string DefaultVersion = "source"; // Default entry of ArchiSteamFarm.version

internal static readonly ArchiLogger ArchiLogger = new ArchiLogger(SharedInfo.ASF);

Expand Down Expand Up @@ -81,6 +82,10 @@ internal static async Task CheckForUpdate(bool updateOverride = false) {
return;
}

if (version.Equals(DefaultVersion)) {
return;
}

if ((AutoUpdatesTimer == null) && Program.GlobalConfig.AutoUpdates) {
TimeSpan autoUpdatePeriod = TimeSpan.FromHours(AutoUpdatePeriodInHours);

Expand Down Expand Up @@ -290,6 +295,7 @@ private static bool IsValidVersion(string version) {
}

switch (version) {
case DefaultVersion:
case "generic":
case "linux-arm":
case "linux-x64":
Expand Down
3 changes: 3 additions & 0 deletions ArchiSteamFarm/ArchiSteamFarm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
</ItemGroup>

<ItemGroup>
<None Update="ArchiSteamFarm.version">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="config\ASF.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
1 change: 1 addition & 0 deletions ArchiSteamFarm/ArchiSteamFarm.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source
4 changes: 1 addition & 3 deletions ArchiSteamFarm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ private static async Task InitASF(string[] args) {
ParsePostInitArgs(args);
}

if (!Debugging.IsDebugBuild) {
await ASF.CheckForUpdate().ConfigureAwait(false);
}
await ASF.CheckForUpdate().ConfigureAwait(false);

await ASF.InitBots().ConfigureAwait(false);
ASF.InitEvents();
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ after_test:
dotnet publish -c "$env:CONFIGURATION" -r "$RUNTIME" -o "out\$RUNTIME"
}
Add-Content "ArchiSteamFarm\out\$RUNTIME\ArchiSteamFarm.version" "$RUNTIME"
Set-Content -Path "ArchiSteamFarm\out\$RUNTIME\ArchiSteamFarm.version" -Value "$RUNTIME"
7z a -bd -tzip -mm=Deflate64 -mx=5 "ArchiSteamFarm\out\ASF-$RUNTIME.zip" "$env:APPVEYOR_BUILD_FOLDER\ArchiSteamFarm\out\$RUNTIME\*"
Push-AppveyorArtifact "ArchiSteamFarm\out\ASF-$RUNTIME.zip" -FileName "ASF-$RUNTIME.zip" -DeploymentName "ASF-$RUNTIME.zip"
Expand Down

0 comments on commit db149d1

Please sign in to comment.