Skip to content

Commit

Permalink
Found case where the .meta guid doesn't match the directory guid
Browse files Browse the repository at this point in the history
Unity takes the .meta guid
  • Loading branch information
m35 committed Jul 20, 2024
1 parent 4ea65a4 commit 7e2e4f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*.properties text
*.xml text
*.ini text
*.md text
*.md text diff=markdown
*.txt text
*.form text eol=lf

Expand Down
11 changes: 8 additions & 3 deletions src/main/java/unitypackage/model/UnityAssetBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
*/
class UnityAssetBuilder {

private static final boolean STRICT = false;

/**
* The directory name, which is also the GUID of the asset.
*/
Expand Down Expand Up @@ -149,9 +151,12 @@ public void addFileFoundInDirectory(TarArchiveEntry tarEntry,
asset_meta_guid = findGuidIn_asset_meta_File(tarEntry, tarInputStream);
if (!asset_meta_guid.equals(guidBaseDirectory)) {
// afaik the directory guid should match the guid in the asset.meta file
throw new RuntimeException("Corrupted .unitypackage: directory guid" +
" " + guidBaseDirectory + " != " +
"asset.meta guid " + asset_meta_guid);
String s = "Corrupted .unitypackage? directory guid" + " " + guidBaseDirectory + " != " + "asset.meta guid " + asset_meta_guid;
if (STRICT) {
throw new RuntimeException(s);
} else {
System.out.println(s);
}
}
break;
case "pathname":
Expand Down

0 comments on commit 7e2e4f8

Please sign in to comment.