Skip to content

Commit 72a8d1d

Browse files
committed
Add replace function for path formatting
It will be useful when defining the output directory. For example, in batch processing, we can use `$replace(%directoryname%,C:\Music,D:\ReEncoded)` to rewrite the output path to another location while retaining the original directory structure.
1 parent e90b1a8 commit 72a8d1d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CUETools.Processor/General.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ public bool Finalise(StringBuilder sb)
266266
try { Returns(sb, Path.GetFileNameWithoutExtension(GetArg(sb, 0))); }
267267
catch { return false; }
268268
return true;
269+
case "replace":
270+
if (positions.Count != 3)
271+
return false;
272+
Returns(sb, GetArg(sb, 0).Replace(GetArg(sb, 1), GetArg(sb, 2)));
273+
return true;
269274
}
270275
return false;
271276
}

0 commit comments

Comments
 (0)