diff options
author | Justin Clarke Casey | 2008-05-28 16:37:43 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-28 16:37:43 +0000 |
commit | 51a43b30a2f0cb76de26102064551816447a675c (patch) | |
tree | 1e6c452a12b8942181dc4fbc61a813716620ecdb /OpenSim/Region/Environment/Modules/World | |
parent | remove terrain bloat, only keep last terrain revision (diff) | |
download | opensim-SC-51a43b30a2f0cb76de26102064551816447a675c.zip opensim-SC-51a43b30a2f0cb76de26102064551816447a675c.tar.gz opensim-SC-51a43b30a2f0cb76de26102064551816447a675c.tar.bz2 opensim-SC-51a43b30a2f0cb76de26102064551816447a675c.tar.xz |
* Put textures into a separate assets/ directory in the opensim archive
* Fix nre where the asset couldn't be found
* Not ready yet
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs | 31 |
2 files changed, 37 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs index ea74941..364b31f 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs | |||
@@ -106,10 +106,20 @@ namespace OpenSim.Region.Environment | |||
106 | TarArchive archive = new TarArchive(); | 106 | TarArchive archive = new TarArchive(); |
107 | 107 | ||
108 | archive.AddFile("prims.xml", m_serializedEntities); | 108 | archive.AddFile("prims.xml", m_serializedEntities); |
109 | |||
110 | // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar | ||
111 | //archive.AddDir("assets"); | ||
109 | 112 | ||
110 | foreach (LLUUID uuid in assets.Keys) | 113 | foreach (LLUUID uuid in assets.Keys) |
111 | { | 114 | { |
112 | archive.AddFile(uuid.ToString() + ".jp2", assets[uuid].Data); | 115 | if (assets[uuid] != null) |
116 | { | ||
117 | archive.AddFile("assets/" + uuid.ToString() + ".jp2", assets[uuid].Data); | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | m_log.DebugFormat("[ARCHIVER]: Could not find asset {0} to archive", uuid); | ||
122 | } | ||
113 | } | 123 | } |
114 | 124 | ||
115 | archive.WriteTar(m_savePath); | 125 | archive.WriteTar(m_savePath); |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs index 3a7518c..c7492fe 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs | |||
@@ -47,6 +47,19 @@ namespace OpenSim.Region.Environment | |||
47 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); | 47 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Add a directory to the tar archive. We can only handle one path level right now! | ||
51 | /// </summary> | ||
52 | /// <param name="dirName"></param> | ||
53 | public void AddDir(string dirName) | ||
54 | { | ||
55 | // Directories are signalled by a final / | ||
56 | if (!dirName.EndsWith("/")) | ||
57 | dirName += "/"; | ||
58 | |||
59 | AddFile(dirName, new byte[0]); | ||
60 | } | ||
61 | |||
62 | /// <summary> | ||
50 | /// Add a file to the tar archive | 63 | /// Add a file to the tar archive |
51 | /// </summary> | 64 | /// </summary> |
52 | /// <param name="filePath"></param> | 65 | /// <param name="filePath"></param> |
@@ -88,7 +101,7 @@ namespace OpenSim.Region.Environment | |||
88 | Array.Copy(nameBytes, header, nameSize); | 101 | Array.Copy(nameBytes, header, nameSize); |
89 | 102 | ||
90 | // file mode (8) | 103 | // file mode (8) |
91 | byte[] modeBytes = m_asciiEncoding.GetBytes("0000644"); | 104 | byte[] modeBytes = m_asciiEncoding.GetBytes("0000755"); |
92 | Array.Copy(modeBytes, 0, header, 100, 7); | 105 | Array.Copy(modeBytes, 0, header, 100, 7); |
93 | 106 | ||
94 | // owner user id (8) | 107 | // owner user id (8) |
@@ -113,7 +126,14 @@ namespace OpenSim.Region.Environment | |||
113 | 126 | ||
114 | // link indicator (1) | 127 | // link indicator (1) |
115 | //header[156] = m_asciiEncoding.GetBytes("0")[0]; | 128 | //header[156] = m_asciiEncoding.GetBytes("0")[0]; |
116 | header[156] = 0; | 129 | if (filePath.EndsWith("/")) |
130 | { | ||
131 | header[156] = m_asciiEncoding.GetBytes("5")[0]; | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | header[156] = 0; | ||
136 | } | ||
117 | 137 | ||
118 | Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7); | 138 | Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7); |
119 | Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7); | 139 | Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7); |
@@ -142,9 +162,10 @@ namespace OpenSim.Region.Environment | |||
142 | // Write out data | 162 | // Write out data |
143 | bw.Write(data); | 163 | bw.Write(data); |
144 | 164 | ||
145 | int paddingRequired = 512 - (data.Length % 512); | 165 | if (data.Length % 512 != 0) |
146 | if (paddingRequired > 0) | ||
147 | { | 166 | { |
167 | int paddingRequired = 512 - (data.Length % 512); | ||
168 | |||
148 | m_log.DebugFormat("Padding data with {0} bytes", paddingRequired); | 169 | m_log.DebugFormat("Padding data with {0} bytes", paddingRequired); |
149 | 170 | ||
150 | byte[] padding = new byte[paddingRequired]; | 171 | byte[] padding = new byte[paddingRequired]; |
@@ -179,4 +200,4 @@ namespace OpenSim.Region.Environment | |||
179 | return oBytes; | 200 | return oBytes; |
180 | } | 201 | } |
181 | } | 202 | } |
182 | } \ No newline at end of file | 203 | } |