Skip to content

Commit

Permalink
fix(RunAsset): fix PathType and LoadLocalRunAssets()
Browse files Browse the repository at this point in the history
  • Loading branch information
MingboPeng committed Mar 6, 2024
1 parent f046c8e commit f97fec5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/PollinationSDK/Wrapper/RunInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,9 @@ public List<RunAssetBase> LoadLocalRunAssets(List<RunAssetBase> runAssets, strin
}
else if (dup is RunOutputAsset output)
{
var isFile = !Helper.IsDirectory(output.RelativePath);
var relativeOutPath = output.RelativePath.Replace("/", @"\");
relativeOutPath = relativeOutPath.StartsWith(@"\") ? relativeOutPath : $@"\{relativeOutPath}";
if (isFile)
if (output.IsFile)
{
var file = Directory.GetFiles(root, "*", SearchOption.AllDirectories).OrderBy(_ => _.Length).FirstOrDefault(_ => _.EndsWith(relativeOutPath));
dup.LocalPath = file;
Expand Down
3 changes: 3 additions & 0 deletions src/PollinationSDK/Wrapper/RunInputAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public RunInputAsset(Interface.Io.Inputs.IStep dagInput, string runSource = defa
// cloud source: CLOUD:mingbo/demo/1D725BD1-44E1-4C3C-85D6-4D98F558DE7C
// local source: LOCAL:C\Users\mingo\simulaiton\1D725BD1
this.RunSource = runSource;

if (dagInput.IsPathType())
this.PathType = dagInput is StepFolderInput ? "folder" : "file";
}

public override AssetBase Duplicate()
Expand Down
4 changes: 4 additions & 0 deletions src/PollinationSDK/Wrapper/RunOutputAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public RunOutputAsset(Interface.Io.Outputs.IDag dagOutput, string platform, stri
// local source: LOCAL:C\Users\mingo\simulaiton\1D725BD1
this.RunSource = runSource;
this.RelativePath = dagOutput.GetOutputPath();

if (dagOutput.IsPathType())
this.PathType = dagOutput is DAGFolderOutput ? "folder" : "file";

}

public override object CheckOutputWithHandler(object inputData, HandlerChecker handlerChecker)
Expand Down

0 comments on commit f97fec5

Please sign in to comment.