Skip to content

Commit

Permalink
fixed packer generating invalid files
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachee committed Aug 23, 2023
1 parent 507f996 commit 67c1b8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion UnityPackageExporter/Package/Packer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public Packer(string projectPath, Stream stream)
_files = new HashSet<string>();
_outStream = stream;
_gzStream = new GZipOutputStream(_outStream);
_gzStream.FileName = "archtemp.tar";
_tarStream = new TarOutputStream(_gzStream);

}
Expand Down Expand Up @@ -108,7 +109,10 @@ public async Task<bool> AddAssetAsync(string filePath)
Logger.Info("Writing File {0} ( {1} )", relativePath, guidString);
await _tarStream.WriteFileAsync(file.FullName, $"{guidString}/asset");
await _tarStream.WriteAllTextAsync($"{guidString}/asset.meta", metaContents);
await _tarStream.WriteAllTextAsync($"{guidString}/pathname", relativePath.Replace('\\', '/'));

string pathname = relativePath.Replace('\\', '/');
if (!pathname.StartsWith("Assets/")) pathname = $"Assets/{pathname}";
await _tarStream.WriteAllTextAsync($"{guidString}/pathname", pathname);
}
catch(FileNotFoundException fnf)
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.0.1"
"version": "1.0.2"
}

0 comments on commit 67c1b8c

Please sign in to comment.