Skip to content

Commit a753940

Browse files
author
MichaelO
committed
fixed path issue
1 parent 659b3bb commit a753940

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog (unofficial)
22

3+
## [1.8.1] - 2022-10-17
4+
- Fixed when choose replace by hash and md5 for bundle name options path issue ("\\" replace "/").
5+
36
## [1.8.0] - 2022-10-15
47
- Added BundleUtility for common methods, can find BundleUtility.MakeMd5ForString method when using AssetBundleBrowser.Utilities.
58
- Added MD5 for bundle name option into ExtendBuildAssetBundleOptions (make a md5 by bundle name to replace it).
-9.05 KB
Loading

Editor/AssetBundleBuildTab.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ internal enum BundleNameOptions
8585
new GUIContent("None"),
8686
new GUIContent("Append Hash To Bundle Name"),
8787
new GUIContent("Replace Bundle Name By Hash"),
88-
new GUIContent("MD5 for Bundle Name")
88+
new GUIContent("Md5 For Bundle Name")
8989
};
9090
int[] m_BundleNameValues = { 0, 1, 2, 3 };
9191

@@ -524,17 +524,18 @@ internal static bool WithoutManifestFile(string outputDirectory)
524524
internal static bool ReplaceBundleNameByHash(string outputDirectory)
525525
{
526526
// outputDirectory last path name = manifestName
527-
var firstIdx = outputDirectory.LastIndexOf("\\") == -1 ? outputDirectory.LastIndexOf("/") : outputDirectory.LastIndexOf("\\");
528-
string manifestName = outputDirectory.Substring(firstIdx + 1, outputDirectory.Length - firstIdx - 1);
527+
outputDirectory = outputDirectory.Replace("\\", "/");
528+
string[] pathArgs = outputDirectory.Split('/');
529+
string manifestName = pathArgs[pathArgs.Length - 1];
529530

530531
string manifestFullPath = string.Empty;
531532

532533
// search from all file to find menifest
533-
string[] files = Directory.GetFiles(outputDirectory, "*.*", SearchOption.AllDirectories);
534+
string[] files = Directory.GetFiles(outputDirectory, "*.*", SearchOption.TopDirectoryOnly);
534535
foreach (var file in files)
535536
{
536-
// check whole path (manifest will build in outputDirectory)
537-
if (file.IndexOf(Path.Combine(outputDirectory, manifestName)) != -1)
537+
// get manifest whole path (manifest will build in outputDirectory)
538+
if (file.IndexOf(manifestName) != -1)
538539
{
539540
manifestFullPath = Path.GetFullPath(file);
540541
break;
@@ -586,8 +587,9 @@ internal static bool ReplaceBundleNameByHash(string outputDirectory)
586587
internal static bool Md5ForBundleName(string outputDirectory)
587588
{
588589
// outputDirectory last path name = manifestName
589-
var firstIdx = outputDirectory.LastIndexOf("\\") == -1 ? outputDirectory.LastIndexOf("/") : outputDirectory.LastIndexOf("\\");
590-
string manifestName = outputDirectory.Substring(firstIdx + 1, outputDirectory.Length - firstIdx - 1);
590+
outputDirectory = outputDirectory.Replace("\\", "/");
591+
string[] pathArgs = outputDirectory.Split('/');
592+
string manifestName = pathArgs[pathArgs.Length - 1];
591593

592594
// search from all file to find menifest
593595
string[] files = Directory.GetFiles(outputDirectory, "*.*", SearchOption.AllDirectories);

Editor/BundleBuildMap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ public static bool BuildAssetBundles(string outputDirectory, AssetBundleBuild[]
584584
if (Convert.ToBoolean(extdOptions & ExtendBuildAssetBundleOptions.Md5ForBundleName))
585585
{
586586
bool completes = AssetBundleBuildTab.Md5ForBundleName(outputDirectory);
587-
if (!completes) Debug.Log("<color=#FF0000>Error in process MD5 for bundle name.</color>");
588-
else Debug.Log($"<color=#60ffb0>Replace all bundle name by MD5.</color>");
587+
if (!completes) Debug.Log("<color=#FF0000>Error in process Md5 for bundle name.</color>");
588+
else Debug.Log($"<color=#60ffb0>Replace all bundle name by Md5.</color>");
589589
}
590590

591591
if (onBuild != null)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "com.unity.assetbundlebrowser.plus",
44
"displayName": "Asset Bundle Browser Plus",
5-
"version": "1.8.0",
5+
"version": "1.8.1",
66
"unity": "2018.1",
77
"description": "The Asset Bundle Browser tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality.\n\nUse this tool as an alternative to selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in Window > AssetBundle Browser. The bundle configuration, build functionality, and built-bundle inspection are split into three tabs within the new window.",
88
"keywords": ["asset", "bundle", "bundles", "assetbundles"],

0 commit comments

Comments
 (0)