From bafdac787408dcffb4ba28be159d44896cfe33b6 Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Wed, 9 Jan 2008 03:57:53 +0000 Subject: 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!) --- .../Communications/Cache/AssetTransactions.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Communications/Cache/AssetTransactions.cs') 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 SaveAssetToFile(filename, Asset.Data); } } - + ///Left this in and commented in case there are unforseen issues + //private void SaveAssetToFile(string filename, byte[] data) + //{ + // FileStream fs = File.Create(filename); + // BinaryWriter bw = new BinaryWriter(fs); + // bw.Write(data); + // bw.Close(); + // fs.Close(); + //} private void SaveAssetToFile(string filename, byte[] data) { - FileStream fs = File.Create(filename); + string assetPath = "UserAssets"; + if (!Directory.Exists(assetPath)) + { + Directory.CreateDirectory(assetPath); + } + FileStream fs = File.Create(Path.Combine(assetPath, filename)); BinaryWriter bw = new BinaryWriter(fs); bw.Write(data); bw.Close(); @@ -428,4 +441,4 @@ namespace OpenSim.Framework.Communications.Cache #endregion } -} \ No newline at end of file +} -- cgit v1.1