Skip to content

Commit

Permalink
detect body path when -b is set as file name
Browse files Browse the repository at this point in the history
  • Loading branch information
UlyssesWu committed Oct 20, 2023
1 parent 0325c09 commit 9a95585
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion FreeMote.PsBuild/PsbDecompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,17 @@ public static void ExtractArchive(string filePath, string key, Dictionary<string
{
if (!File.Exists(bodyPath))
{
Logger.LogWarn($"Can not find body from specified path: {bodyPath}");
if (!Path.IsPathRooted(bodyPath) && Path.IsPathRooted(filePath))
{
var bodyFullPath = Path.Combine(Path.GetDirectoryName(filePath), bodyPath);
if (File.Exists(bodyFullPath))
{
body = bodyFullPath;
hasBody = true;
bodyBinName = Path.GetFileName(bodyPath);
Logger.Log($"Body FilePath: {bodyFullPath}");
}
}
}
else
{
Expand All @@ -430,6 +440,11 @@ public static void ExtractArchive(string filePath, string key, Dictionary<string
bodyBinName = Path.GetFileName(bodyPath);
Logger.Log($"Body FilePath: {bodyPath}");
}

if (!hasBody)
{
Logger.LogWarn($"Can not find body from specified path: {bodyPath}");
}
}
else
{
Expand Down

0 comments on commit 9a95585

Please sign in to comment.