Skip to content

Commit c3132e5

Browse files
author
Stewart Miles
committed
Added option to move files to their export paths.
Since all files can now be tagged with the exportpath, this commit adds a menu option to move all files to their original locations. Bug: 127793909 Change-Id: I457599054d9696d438592ddf3378a4e5c5144da6
1 parent f57da70 commit c3132e5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

source/VersionHandlerImpl/src/VersionHandlerImpl.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,6 +2333,34 @@ public static void DisplayInstalledPackages() {
23332333
}
23342334
}
23352335

2336+
/// <summary>
2337+
/// Menu item which moves all managed files to their initial install locations.
2338+
/// </summary>
2339+
[MenuItem("Assets/External Dependency Manager/Version Handler/Move Files To Install Locations")]
2340+
public static void MoveFilesToInstallLocations() {
2341+
var manifests = ManifestReferences.FindAndReadManifestsInAssetsFolder();
2342+
foreach (var pkg in manifests) {
2343+
if (!String.IsNullOrEmpty(pkg.filenameCanonical) && pkg.metadataByVersion != null) {
2344+
var logLines = new List<string>();
2345+
foreach (var metadata in pkg.metadataByFilename.Values) {
2346+
if (!String.IsNullOrEmpty(metadata.exportPath)) {
2347+
var originalFilename = metadata.filename;
2348+
if (originalFilename != metadata.exportPath &&
2349+
metadata.RenameAsset(metadata.exportPath)) {
2350+
logLines.Add(String.Format("{0} --> {1}", originalFilename,
2351+
metadata.exportPath));
2352+
}
2353+
}
2354+
}
2355+
if (logLines.Count > 0) {
2356+
Log(String.Format("'{0}' files moved to their install locations:\n{1}",
2357+
pkg.filenameCanonical,
2358+
String.Join("\n", logLines.ToArray())));
2359+
}
2360+
}
2361+
}
2362+
}
2363+
23362364
/// <summary>
23372365
/// Delegate used to filter a file and directory names.
23382366
/// </summary>

0 commit comments

Comments
 (0)