com.xmobitea.changx.mini-localization 1.4.8 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,11 +13,9 @@
13
13
  [CustomEditor(typeof(LocalizationManager))]
14
14
  public class LocalizationManagerEditor : Editor
15
15
  {
16
- private const string Version = "1.4.8";
17
- private const string Library = @".\Library\PackageCache\com.xmobitea.changx.mini-localization@" + Version;
18
- //private const string Library = @".\Assets\MiniLocalization";
19
- private const string ProcessPath = @"\Editor\Tools\GetLocalizationTools";
20
- private const string CredentialsPath = @"\Editor\Tools\GetLocalizationTools\credentials.json";
16
+ private const string LibraryPackageCachePath = @"Library\PackageCache";
17
+ private const string ProcessPath = @"Editor\Tools\GetLocalizationTools";
18
+ private const string CredentialsPath = @"Editor\Tools\GetLocalizationTools\credentials.json";
21
19
 
22
20
  public override void OnInspectorGUI()
23
21
  {
@@ -75,7 +73,11 @@
75
73
 
76
74
  if (!usingFetchLocalLocalization && !usingFetchOnlineLocalization) return;
77
75
 
78
- var processPath = Library + ProcessPath;
76
+ var localizationInPackageCache = GetLocalizationInPackageCache();
77
+ if (!localizationInPackageCache.EndsWith("\\") && !localizationInPackageCache.EndsWith("/"))
78
+ localizationInPackageCache += "/";
79
+
80
+ var processPath = localizationInPackageCache + ProcessPath;
79
81
 
80
82
  var filePath123 = "GetLocalization";
81
83
  var folderPath = "";
@@ -96,7 +98,7 @@
96
98
 
97
99
  processPath += "\\" + folderPath + "\\" + filePath123;
98
100
 
99
- var credentialsPath = Library + CredentialsPath;
101
+ var credentialsPath = localizationInPackageCache + CredentialsPath;
100
102
 
101
103
  var arguments = credentialsPath + " " + worksheetKey + (usingFetchLocalLocalization ? " true " : " false ") + (usingFetchOnlineLocalization ? "true " : "false ") + (string.IsNullOrEmpty(localizationSettings.SheetnameFetchLocalLocalization) ? "local" : localizationSettings.SheetnameFetchLocalLocalization) + " " + (string.IsNullOrEmpty(localizationSettings.SheetnameFetchOnlineLocalization) ? "online" : localizationSettings.SheetnameFetchOnlineLocalization);
102
104
 
@@ -163,6 +165,23 @@
163
165
  GenerateLocalizationConstantId();
164
166
  }
165
167
 
168
+ private static string GetLocalizationInPackageCache()
169
+ {
170
+ var directoryInfo = new DirectoryInfo(Application.dataPath + "/../" + LibraryPackageCachePath);
171
+
172
+ var allDirectoriesPackage = directoryInfo.GetDirectories();
173
+
174
+ foreach (var c in allDirectoriesPackage)
175
+ {
176
+ if (c.Name.StartsWith("com.xmobitea.changx.mini-localization@"))
177
+ {
178
+ return c.FullName;
179
+ }
180
+ }
181
+
182
+ throw new System.Exception("[Localization] Not found package com.xmobitea.changx.mini-localization in Library/PackageCache/");
183
+ }
184
+
166
185
  [MenuItem("XmobiTea Tools/Localization/Generate LocalizationConstantId.cs")]
167
186
  public static void GenerateLocalizationConstantId()
168
187
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.xmobitea.changx.mini-localization",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "displayName": "XmobiTea Localization",
5
5
  "description": "XmobiTea Unity Toolkit packages",
6
6
  "unity": "2020.3",