From 85e21ab7e9dbd231594837738ef4d8b0ccfbd109 Mon Sep 17 00:00:00 2001
From: mirkoaquaro <36816045+mirkoaquaro@users.noreply.github.com>
Date: Sun, 25 Feb 2018 14:59:44 +0100
Subject: [PATCH 1/2] Added property to dinamically get the GooglePlayGames
root directory path
In the previous version of GPGSUtil.cs the GooglePlayGames directory path was hardcoded in all the fields requiring it, making it impossible to move the folder from "Assets" into a subfolder.
With this new version the issue is fixed and the GooglePlayGames directory can now be moved in any another project folder making it cleaner, tidier and less bloated.
---
.../Assets/GooglePlayGames/Editor/GPGSUtil.cs | 48 ++++++++++++++-----
1 file changed, 35 insertions(+), 13 deletions(-)
diff --git a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs
index dfe6ac547..d55262695 100644
--- a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs
+++ b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs
@@ -97,18 +97,40 @@ public static class GPGSUtil
/// Constant for token replacement
private const string CONSTANTSPLACEHOLDER = "__Constant_Properties__";
- ///
- /// The game info file path. This is a generated file.
- ///
- private const string GameInfoPath = "Assets/GooglePlayGames/GameInfo.cs";
-
- ///
- /// The manifest path.
- ///
- /// The Games SDK requires additional metadata in the AndroidManifest.xml
- /// file.
- private const string ManifestPath =
- "Assets/GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml";
+ ///
+ /// The game info file path. This is a generated file.
+ ///
+ private static string GameInfoPath {
+ get {
+ return GooglePlayGamesRootDirectory + "GameInfo.cs";
+ }
+ }
+
+
+ ///
+ /// The manifest path.
+ ///
+ /// The Games SDK requires additional metadata in the AndroidManifest.xml
+ /// file.
+ private static string ManifestPath {
+ get {
+ return GooglePlayGamesRootDirectory + "Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml";
+ }
+ }
+
+
+ ///
+ /// The root directory of the plugin
+ ///
+ ///
+ /// file.
+ 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;
+ }
+ }
///
/// The map of replacements for filling in code templates. The
@@ -166,7 +188,7 @@ public static string ReadFile(string filePath)
/// Name of the template in the editor directory.
public static string ReadEditorTemplate(string name)
{
- return ReadFile(SlashesToPlatformSeparator("Assets/GooglePlayGames/Editor/" + name + ".txt"));
+ return ReadFile (SlashesToPlatformSeparator (GooglePlayGamesRootDirectory + "Editor/" + name + ".txt"));
}
///
From 4840ae9186a34f7d7c8425f2fbd7b384944956e2 Mon Sep 17 00:00:00 2001
From: Mirko Aquaro <36816045+mirkoaquaro@users.noreply.github.com>
Date: Sun, 25 Feb 2018 19:13:27 +0100
Subject: [PATCH 2/2] Update GPGSUtil.cs
---
source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs | 2 --
1 file changed, 2 deletions(-)
diff --git a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs
index d55262695..874d50b0e 100644
--- a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs
+++ b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs
@@ -122,8 +122,6 @@ private static string ManifestPath {
///
/// The root directory of the plugin
///
- ///
- /// file.
private static string GooglePlayGamesRootDirectory {
get {
string[] res = System.IO.Directory.GetFiles (Application.dataPath, "GPGSUtil.cs", SearchOption.AllDirectories);