diff options
author | Brian McBee | 2008-01-09 03:57:53 +0000 |
---|---|---|
committer | Brian McBee | 2008-01-09 03:57:53 +0000 |
commit | bafdac787408dcffb4ba28be159d44896cfe33b6 (patch) | |
tree | 219f4509761ca57c9b9a44b2ffd0b0a0e083f6f9 /OpenSim/Framework/Communications/Cache/AssetTransactions.cs | |
parent | Third part of CharlieO's library rework. We now have library organization! Th... (diff) | |
download | opensim-SC-bafdac787408dcffb4ba28be159d44896cfe33b6.zip opensim-SC-bafdac787408dcffb4ba28be159d44896cfe33b6.tar.gz opensim-SC-bafdac787408dcffb4ba28be159d44896cfe33b6.tar.bz2 opensim-SC-bafdac787408dcffb4ba28be159d44896cfe33b6.tar.xz |
dump_assets_to_file=true will now cause the asset to go into a UserAssets subdirectory of bin instead of cluttering up your bin directory (Thanks CharlieO!)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetTransactions.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs index 8aa567c..dd1f8ba 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs | |||
@@ -237,10 +237,23 @@ namespace OpenSim.Framework.Communications.Cache | |||
237 | SaveAssetToFile(filename, Asset.Data); | 237 | SaveAssetToFile(filename, Asset.Data); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ///Left this in and commented in case there are unforseen issues | |
241 | //private void SaveAssetToFile(string filename, byte[] data) | ||
242 | //{ | ||
243 | // FileStream fs = File.Create(filename); | ||
244 | // BinaryWriter bw = new BinaryWriter(fs); | ||
245 | // bw.Write(data); | ||
246 | // bw.Close(); | ||
247 | // fs.Close(); | ||
248 | //} | ||
241 | private void SaveAssetToFile(string filename, byte[] data) | 249 | private void SaveAssetToFile(string filename, byte[] data) |
242 | { | 250 | { |
243 | FileStream fs = File.Create(filename); | 251 | string assetPath = "UserAssets"; |
252 | if (!Directory.Exists(assetPath)) | ||
253 | { | ||
254 | Directory.CreateDirectory(assetPath); | ||
255 | } | ||
256 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
244 | BinaryWriter bw = new BinaryWriter(fs); | 257 | BinaryWriter bw = new BinaryWriter(fs); |
245 | bw.Write(data); | 258 | bw.Write(data); |
246 | bw.Close(); | 259 | bw.Close(); |
@@ -428,4 +441,4 @@ namespace OpenSim.Framework.Communications.Cache | |||
428 | 441 | ||
429 | #endregion | 442 | #endregion |
430 | } | 443 | } |
431 | } \ No newline at end of file | 444 | } |