[CLI] Add flag to allow removing container path prefix.

- Added --strip-path-prefix flag
This commit is contained in:
middlered
2025-11-09 21:05:59 +08:00
parent aa5768850b
commit de967527ef
3 changed files with 46 additions and 2 deletions
+16
View File
@@ -125,6 +125,7 @@ namespace AssetStudioCLI.Options
public static Option<int> o_maxParallelExportTasks;
public static Option<ExportListType> o_exportAssetList;
public static Option<string> o_assemblyPath;
public static Option<string> o_stripPathPrefix;
public static Option<UnityVersion> o_unityVersion;
public static Option<bool> f_decompressToDisk;
public static Option<bool> f_notRestoreExtensionName;
@@ -534,6 +535,14 @@ namespace AssetStudioCLI.Options
optionExample: "",
optionHelpGroup: HelpGroups.Advanced
);
o_stripPathPrefix = new GroupedOption<string>
(
optionDefaultValue: "",
optionName: "--strip-path-prefix <path>",
optionDescription: "Specify a path prefix to be stripped from exported asset paths\n",
optionExample: "Example: \"--strip-path-prefix assets/models/char/\"\n",
optionHelpGroup: HelpGroups.Advanced
);
o_unityVersion = new GroupedOption<UnityVersion>
(
optionDefaultValue: null,
@@ -1245,6 +1254,13 @@ namespace AssetStudioCLI.Options
return;
}
break;
case "--strip-path-prefix":
o_stripPathPrefix.Value = Path.Combine(Path.GetDirectoryName(value), Path.GetFileName(value));
if (!o_stripPathPrefix.Value.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
o_stripPathPrefix.Value += Path.DirectorySeparatorChar;
}
break;
case "--unity-version":
try
{