* Put textures into a separate assets/ directory in the opensim archive
* Fix nre where the asset couldn't be found * Not ready yet0.6.0-stable
parent
7ddf183da4
commit
51a43b30a2
|
@ -107,9 +107,19 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
archive.AddFile("prims.xml", m_serializedEntities);
|
archive.AddFile("prims.xml", m_serializedEntities);
|
||||||
|
|
||||||
|
// It appears that gtar, at least, doesn't need the intermediate directory entries in the tar
|
||||||
|
//archive.AddDir("assets");
|
||||||
|
|
||||||
foreach (LLUUID uuid in assets.Keys)
|
foreach (LLUUID uuid in assets.Keys)
|
||||||
{
|
{
|
||||||
archive.AddFile(uuid.ToString() + ".jp2", assets[uuid].Data);
|
if (assets[uuid] != null)
|
||||||
|
{
|
||||||
|
archive.AddFile("assets/" + uuid.ToString() + ".jp2", assets[uuid].Data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ARCHIVER]: Could not find asset {0} to archive", uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
archive.WriteTar(m_savePath);
|
archive.WriteTar(m_savePath);
|
||||||
|
|
|
@ -46,6 +46,19 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
|
protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a directory to the tar archive. We can only handle one path level right now!
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dirName"></param>
|
||||||
|
public void AddDir(string dirName)
|
||||||
|
{
|
||||||
|
// Directories are signalled by a final /
|
||||||
|
if (!dirName.EndsWith("/"))
|
||||||
|
dirName += "/";
|
||||||
|
|
||||||
|
AddFile(dirName, new byte[0]);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a file to the tar archive
|
/// Add a file to the tar archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -88,7 +101,7 @@ namespace OpenSim.Region.Environment
|
||||||
Array.Copy(nameBytes, header, nameSize);
|
Array.Copy(nameBytes, header, nameSize);
|
||||||
|
|
||||||
// file mode (8)
|
// file mode (8)
|
||||||
byte[] modeBytes = m_asciiEncoding.GetBytes("0000644");
|
byte[] modeBytes = m_asciiEncoding.GetBytes("0000755");
|
||||||
Array.Copy(modeBytes, 0, header, 100, 7);
|
Array.Copy(modeBytes, 0, header, 100, 7);
|
||||||
|
|
||||||
// owner user id (8)
|
// owner user id (8)
|
||||||
|
@ -113,7 +126,14 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
// link indicator (1)
|
// link indicator (1)
|
||||||
//header[156] = m_asciiEncoding.GetBytes("0")[0];
|
//header[156] = m_asciiEncoding.GetBytes("0")[0];
|
||||||
|
if (filePath.EndsWith("/"))
|
||||||
|
{
|
||||||
|
header[156] = m_asciiEncoding.GetBytes("5")[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
header[156] = 0;
|
header[156] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7);
|
Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7);
|
||||||
Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7);
|
Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7);
|
||||||
|
@ -142,9 +162,10 @@ namespace OpenSim.Region.Environment
|
||||||
// Write out data
|
// Write out data
|
||||||
bw.Write(data);
|
bw.Write(data);
|
||||||
|
|
||||||
int paddingRequired = 512 - (data.Length % 512);
|
if (data.Length % 512 != 0)
|
||||||
if (paddingRequired > 0)
|
|
||||||
{
|
{
|
||||||
|
int paddingRequired = 512 - (data.Length % 512);
|
||||||
|
|
||||||
m_log.DebugFormat("Padding data with {0} bytes", paddingRequired);
|
m_log.DebugFormat("Padding data with {0} bytes", paddingRequired);
|
||||||
|
|
||||||
byte[] padding = new byte[paddingRequired];
|
byte[] padding = new byte[paddingRequired];
|
||||||
|
|
Loading…
Reference in New Issue