Skip to content

Commit

Permalink
fix(LoadLocalRunAssets): get the shorter path if there are multiple p…
Browse files Browse the repository at this point in the history
…aths found
  • Loading branch information
MingboPeng committed Sep 18, 2023
1 parent 2692d52 commit 7adb1fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PollinationSDK/Wrapper/RunInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ public List<RunAssetBase> LoadLocalRunAssets(List<RunAssetBase> runAssets, strin
relativeOutPath = relativeOutPath.StartsWith(@"\") ? relativeOutPath : $@"\{relativeOutPath}";
if (isFile)
{
var file = Directory.GetFiles(root, "*", SearchOption.AllDirectories).FirstOrDefault(_=>_.EndsWith(relativeOutPath));
var file = Directory.GetFiles(root, "*", SearchOption.AllDirectories).OrderBy(_ => _.Length).FirstOrDefault(_ => _.EndsWith(relativeOutPath));
dup.LocalPath = file;
}
else
{
//this is an output folder
var dir = Directory.GetDirectories(root, "*", SearchOption.AllDirectories).FirstOrDefault(_ => _.EndsWith(relativeOutPath));
var dir = Directory.GetDirectories(root, "*", SearchOption.AllDirectories).OrderBy(_ => _.Length).FirstOrDefault(_ => _.EndsWith(relativeOutPath));
dup.LocalPath = dir;
}

Expand Down

0 comments on commit 7adb1fe

Please sign in to comment.