Skip to content

Commit

Permalink
fixed path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelO committed Oct 17, 2022
1 parent 659b3bb commit a753940
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog (unofficial)

## [1.8.1] - 2022-10-17
- Fixed when choose replace by hash and md5 for bundle name options path issue ("\\" replace "/").

## [1.8.0] - 2022-10-15
- Added BundleUtility for common methods, can find BundleUtility.MakeMd5ForString method when using AssetBundleBrowser.Utilities.
- Added MD5 for bundle name option into ExtendBuildAssetBundleOptions (make a md5 by bundle name to replace it).
Expand Down
Binary file modified Documentation/images/desc_img_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 10 additions & 8 deletions Editor/AssetBundleBuildTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ internal enum BundleNameOptions
new GUIContent("None"),
new GUIContent("Append Hash To Bundle Name"),
new GUIContent("Replace Bundle Name By Hash"),
new GUIContent("MD5 for Bundle Name")
new GUIContent("Md5 For Bundle Name")
};
int[] m_BundleNameValues = { 0, 1, 2, 3 };

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

string manifestFullPath = string.Empty;

// search from all file to find menifest
string[] files = Directory.GetFiles(outputDirectory, "*.*", SearchOption.AllDirectories);
string[] files = Directory.GetFiles(outputDirectory, "*.*", SearchOption.TopDirectoryOnly);
foreach (var file in files)
{
// check whole path (manifest will build in outputDirectory)
if (file.IndexOf(Path.Combine(outputDirectory, manifestName)) != -1)
// get manifest whole path (manifest will build in outputDirectory)
if (file.IndexOf(manifestName) != -1)
{
manifestFullPath = Path.GetFullPath(file);
break;
Expand Down Expand Up @@ -586,8 +587,9 @@ internal static bool ReplaceBundleNameByHash(string outputDirectory)
internal static bool Md5ForBundleName(string outputDirectory)
{
// outputDirectory last path name = manifestName
var firstIdx = outputDirectory.LastIndexOf("\\") == -1 ? outputDirectory.LastIndexOf("/") : outputDirectory.LastIndexOf("\\");
string manifestName = outputDirectory.Substring(firstIdx + 1, outputDirectory.Length - firstIdx - 1);
outputDirectory = outputDirectory.Replace("\\", "/");
string[] pathArgs = outputDirectory.Split('/');
string manifestName = pathArgs[pathArgs.Length - 1];

// search from all file to find menifest
string[] files = Directory.GetFiles(outputDirectory, "*.*", SearchOption.AllDirectories);
Expand Down
4 changes: 2 additions & 2 deletions Editor/BundleBuildMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ public static bool BuildAssetBundles(string outputDirectory, AssetBundleBuild[]
if (Convert.ToBoolean(extdOptions & ExtendBuildAssetBundleOptions.Md5ForBundleName))
{
bool completes = AssetBundleBuildTab.Md5ForBundleName(outputDirectory);
if (!completes) Debug.Log("<color=#FF0000>Error in process MD5 for bundle name.</color>");
else Debug.Log($"<color=#60ffb0>Replace all bundle name by MD5.</color>");
if (!completes) Debug.Log("<color=#FF0000>Error in process Md5 for bundle name.</color>");
else Debug.Log($"<color=#60ffb0>Replace all bundle name by Md5.</color>");
}

if (onBuild != null)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "com.unity.assetbundlebrowser.plus",
"displayName": "Asset Bundle Browser Plus",
"version": "1.8.0",
"version": "1.8.1",
"unity": "2018.1",
"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.",
"keywords": ["asset", "bundle", "bundles", "assetbundles"],
Expand Down

0 comments on commit a753940

Please sign in to comment.