mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-15 19:28:48 -05:00
[CLI] Add flag to allow removing container path prefix.
- Added --strip-path-prefix flag
This commit is contained in:
@@ -659,6 +659,26 @@ namespace AssetStudioCLI
|
||||
var parallelExportCount = CLIOptions.o_maxParallelExportTasks.Value;
|
||||
var toExportAssetDict = new ConcurrentDictionary<AssetItem, string>();
|
||||
var toParallelExportAssetDict = new ConcurrentDictionary<AssetItem, string>();
|
||||
|
||||
if (CLIOptions.o_stripPathPrefix.Value != null)
|
||||
{
|
||||
foreach (var asset in parsedAssetsList)
|
||||
{
|
||||
var containerPath = asset.Container;
|
||||
if (string.IsNullOrEmpty(containerPath))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!Path.Combine(Path.GetDirectoryName(containerPath), Path.GetFileName(containerPath)).StartsWith(CLIOptions.o_stripPathPrefix.Value))
|
||||
{
|
||||
Logger.Warning($"Asset container path \"{asset.Container}\" does not start with the specified path prefix \"{CLIOptions.o_stripPathPrefix.Value}\"");
|
||||
Logger.Warning("strip path prefix option will be ignored.");
|
||||
CLIOptions.o_stripPathPrefix.Value = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Parallel.ForEach(parsedAssetsList, asset =>
|
||||
{
|
||||
string exportPath;
|
||||
@@ -671,7 +691,12 @@ namespace AssetStudioCLI
|
||||
case AssetGroupOption.ContainerPathFull:
|
||||
if (!string.IsNullOrEmpty(asset.Container))
|
||||
{
|
||||
exportPath = Path.Combine(savePath, Path.GetDirectoryName(asset.Container));
|
||||
var containerPath = Path.GetDirectoryName(asset.Container);
|
||||
if (CLIOptions.o_stripPathPrefix.Value != null)
|
||||
{
|
||||
containerPath = containerPath.Substring(CLIOptions.o_stripPathPrefix.Value.Length);
|
||||
}
|
||||
exportPath = Path.Combine(savePath, containerPath);
|
||||
if (groupOption == AssetGroupOption.ContainerPathFull)
|
||||
{
|
||||
exportPath = Path.Combine(exportPath, Path.GetFileNameWithoutExtension(asset.Container));
|
||||
@@ -740,7 +765,7 @@ namespace AssetStudioCLI
|
||||
toExportAssetDict.TryAdd(asset, exportPath);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
foreach (var toExportAsset in toExportAssetDict)
|
||||
{
|
||||
var asset = toExportAsset.Key;
|
||||
|
||||
Reference in New Issue
Block a user