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

Added property to dinamically get the GooglePlayGames root directory … #2120

Open
wants to merge 2 commits 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
46 changes: 33 additions & 13 deletions source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,38 @@ public static class GPGSUtil
/// <summary>Constant for token replacement</summary>
private const string CONSTANTSPLACEHOLDER = "__Constant_Properties__";

/// <summary>
/// The game info file path. This is a generated file.
/// </summary>
private const string GameInfoPath = "Assets/GooglePlayGames/GameInfo.cs";

/// <summary>
/// The manifest path.
/// </summary>
/// <remarks>The Games SDK requires additional metadata in the AndroidManifest.xml
/// file. </remarks>
private const string ManifestPath =
"Assets/GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml";
/// <summary>
/// The game info file path. This is a generated file.
/// </summary>
private static string GameInfoPath {
get {
return GooglePlayGamesRootDirectory + "GameInfo.cs";
}
}


/// <summary>
/// The manifest path.
/// </summary>
/// <remarks>The Games SDK requires additional metadata in the AndroidManifest.xml
/// file. </remarks>
private static string ManifestPath {
get {
return GooglePlayGamesRootDirectory + "Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml";
}
}


/// <summary>
/// The root directory of the plugin
/// </summary>
private static string GooglePlayGamesRootDirectory {
get {
string[] res = System.IO.Directory.GetFiles (Application.dataPath, "GPGSUtil.cs", SearchOption.AllDirectories);
string path = res [0].Replace ("Editor/GPGSUtil.cs", "").Replace ("\\", "/");
return path;
}
}

/// <summary>
/// The map of replacements for filling in code templates. The
Expand Down Expand Up @@ -166,7 +186,7 @@ public static string ReadFile(string filePath)
/// <param name="name">Name of the template in the editor directory.</param>
public static string ReadEditorTemplate(string name)
{
return ReadFile(SlashesToPlatformSeparator("Assets/GooglePlayGames/Editor/" + name + ".txt"));
return ReadFile (SlashesToPlatformSeparator (GooglePlayGamesRootDirectory + "Editor/" + name + ".txt"));
}

/// <summary>
Expand Down