refactor: change method argument name
parent
46d64da830
commit
36a40e0295
|
@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replicate the inventory paths in the archive to the user's inventory as necessary.
|
/// Replicate the inventory paths in the archive to the user's inventory as necessary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fsPath"></param>
|
/// <param name="archivePath">The item archive path to replicate</param>
|
||||||
/// <param name="isDir">Is the path we're dealing with a directory?</param>
|
/// <param name="isDir">Is the path we're dealing with a directory?</param>
|
||||||
/// <param name="rootDestinationFolder">The root folder for the inventory load</param>
|
/// <param name="rootDestinationFolder">The root folder for the inventory load</param>
|
||||||
/// <param name="foldersCreated">
|
/// <param name="foldersCreated">
|
||||||
|
@ -218,49 +218,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
||||||
public InventoryFolderBase ReplicateArchivePathToUserInventory(
|
public InventoryFolderBase ReplicateArchivePathToUserInventory(
|
||||||
string fsPath,
|
string archivePath,
|
||||||
bool isDir,
|
bool isDir,
|
||||||
InventoryFolderBase rootDestFolder,
|
InventoryFolderBase rootDestFolder,
|
||||||
Dictionary <string, InventoryFolderBase> foldersCreated,
|
Dictionary <string, InventoryFolderBase> foldersCreated,
|
||||||
List<InventoryNodeBase> nodesLoaded)
|
List<InventoryNodeBase> nodesLoaded)
|
||||||
{
|
{
|
||||||
fsPath = fsPath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
|
archivePath = archivePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
|
||||||
|
|
||||||
// Remove the file portion if we aren't already dealing with a directory path
|
// Remove the file portion if we aren't already dealing with a directory path
|
||||||
if (!isDir)
|
if (!isDir)
|
||||||
fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1);
|
archivePath = archivePath.Remove(archivePath.LastIndexOf("/") + 1);
|
||||||
|
|
||||||
string originalFsPath = fsPath;
|
string originalArchivePath = archivePath;
|
||||||
|
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath);
|
m_log.DebugFormat(
|
||||||
|
"[INVENTORY ARCHIVER]: Loading to folder {0 {1}}", rootDestFolder.Name, rootDestFolder.ID);
|
||||||
|
|
||||||
InventoryFolderBase destFolder = null;
|
InventoryFolderBase destFolder = null;
|
||||||
|
|
||||||
// XXX: Nasty way of dealing with a path that has no directory component
|
// XXX: Nasty way of dealing with a path that has no directory component
|
||||||
if (fsPath.Length > 0)
|
if (archivePath.Length > 0)
|
||||||
{
|
{
|
||||||
while (null == destFolder && fsPath.Length > 0)
|
while (null == destFolder && archivePath.Length > 0)
|
||||||
{
|
{
|
||||||
if (foldersCreated.ContainsKey(fsPath))
|
if (foldersCreated.ContainsKey(archivePath))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Found previously created fs path {0}", fsPath);
|
m_log.DebugFormat(
|
||||||
destFolder = foldersCreated[fsPath];
|
"[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
|
||||||
|
destFolder = foldersCreated[archivePath];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Don't include the last slash
|
// Don't include the last slash
|
||||||
int penultimateSlashIndex = fsPath.LastIndexOf("/", fsPath.Length - 2);
|
int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
|
||||||
|
|
||||||
if (penultimateSlashIndex >= 0)
|
if (penultimateSlashIndex >= 0)
|
||||||
{
|
{
|
||||||
fsPath = fsPath.Remove(penultimateSlashIndex + 1);
|
archivePath = archivePath.Remove(penultimateSlashIndex + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[INVENTORY ARCHIVER]: Found no previously created fs path for {0}",
|
"[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
|
||||||
originalFsPath);
|
originalArchivePath);
|
||||||
fsPath = string.Empty;
|
archivePath = string.Empty;
|
||||||
destFolder = rootDestFolder;
|
destFolder = rootDestFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,14 +273,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
destFolder = rootDestFolder;
|
destFolder = rootDestFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length);
|
string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length);
|
||||||
string[] rawDirsToCreate
|
string[] rawDirsToCreate
|
||||||
= fsPathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
= archivePathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (i < rawDirsToCreate.Length)
|
while (i < rawDirsToCreate.Length)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawDirsToCreate[i]);
|
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading archived folder {0}", rawDirsToCreate[i]);
|
||||||
|
|
||||||
int identicalNameIdentifierIndex
|
int identicalNameIdentifierIndex
|
||||||
= rawDirsToCreate[i].LastIndexOf(
|
= rawDirsToCreate[i].LastIndexOf(
|
||||||
|
@ -305,9 +307,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// foundFolder.Name, foundFolder.ID);
|
// foundFolder.Name, foundFolder.ID);
|
||||||
|
|
||||||
// Record that we have now created this folder
|
// Record that we have now created this folder
|
||||||
fsPath += rawDirsToCreate[i] + "/";
|
archivePath += rawDirsToCreate[i] + "/";
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath);
|
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loaded archive path {0}", archivePath);
|
||||||
foldersCreated[fsPath] = destFolder;
|
foldersCreated[archivePath] = destFolder;
|
||||||
|
|
||||||
if (0 == i)
|
if (0 == i)
|
||||||
nodesLoaded.Add(destFolder);
|
nodesLoaded.Add(destFolder);
|
||||||
|
|
Loading…
Reference in New Issue