Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RedistCopy.cs #495

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions com.rlabrecque.steamworks.net/Editor/RedistCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj
CopyDebugInfo(target, pathToBuiltProject);

DeleteOldSteamApiDlls(target, pathToBuiltProject);

WriteSteamAppIdTxtFile(target, pathToBuiltProject);
}

static void CopyDebugInfo(BuildTarget target, string pathToBuiltProject) {
Expand Down Expand Up @@ -71,6 +73,31 @@ static void DeleteOldSteamApiDlls(BuildTarget target, string pathToBuiltProject)
}
}
}

static void WriteSteamAppIdTxtFile(BuildTarget target, string pathToBuiltProject)
{
string basePath = Path.GetDirectoryName(pathToBuiltProject);
string strSteamAppIdPath = Path.Combine(basePath, "steam_appid.txt");

// If the steam_appid.txt file already exists, then there's nothing to do.
if (File.Exists(strSteamAppIdPath)) {
return;
}

Debug.Log("[Steamworks.NET] 'steam_appid.txt' is not present in the project root. Writing...");

try {
StreamWriter appIdFile = File.CreateText(strSteamAppIdPath);
appIdFile.Write("480");
appIdFile.Close();

Debug.Log("[Steamworks.NET] Successfully copied 'steam_appid.txt' into the project root.");
}
catch (System.Exception e) {
Debug.LogWarning("[Steamworks.NET] Could not copy 'steam_appid.txt' into the project root. Please place 'steam_appid.txt' into the project root manually.");
Debug.LogException(e);
}
}
}

#endif // !DISABLESTEAMWORKS