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/Capabilities | |
parent | Third part of CharlieO's library rework. We now have library organization! Th... (diff) | |
download | opensim-SC_OLD-bafdac787408dcffb4ba28be159d44896cfe33b6.zip opensim-SC_OLD-bafdac787408dcffb4ba28be159d44896cfe33b6.tar.gz opensim-SC_OLD-bafdac787408dcffb4ba28be159d44896cfe33b6.tar.bz2 opensim-SC_OLD-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 'OpenSim/Framework/Communications/Capabilities')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 4b42046..74d8125 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -536,10 +536,23 @@ namespace OpenSim.Region.Capabilities | |||
536 | 536 | ||
537 | return res; | 537 | return res; |
538 | } | 538 | } |
539 | 539 | ///Left this in and commented in case there are unforseen issues | |
540 | //private void SaveAssetToFile(string filename, byte[] data) | ||
541 | //{ | ||
542 | // FileStream fs = File.Create(filename); | ||
543 | // BinaryWriter bw = new BinaryWriter(fs); | ||
544 | // bw.Write(data); | ||
545 | // bw.Close(); | ||
546 | // fs.Close(); | ||
547 | //} | ||
540 | private void SaveAssetToFile(string filename, byte[] data) | 548 | private void SaveAssetToFile(string filename, byte[] data) |
541 | { | 549 | { |
542 | FileStream fs = File.Create(filename); | 550 | string assetPath = "UserAssets"; |
551 | if (!Directory.Exists(assetPath)) | ||
552 | { | ||
553 | Directory.CreateDirectory(assetPath); | ||
554 | } | ||
555 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
543 | BinaryWriter bw = new BinaryWriter(fs); | 556 | BinaryWriter bw = new BinaryWriter(fs); |
544 | bw.Write(data); | 557 | bw.Write(data); |
545 | bw.Close(); | 558 | bw.Close(); |
@@ -603,10 +616,23 @@ namespace OpenSim.Region.Capabilities | |||
603 | 616 | ||
604 | return res; | 617 | return res; |
605 | } | 618 | } |
606 | 619 | ///Left this in and commented in case there are unforseen issues | |
620 | //private void SaveAssetToFile(string filename, byte[] data) | ||
621 | //{ | ||
622 | // FileStream fs = File.Create(filename); | ||
623 | // BinaryWriter bw = new BinaryWriter(fs); | ||
624 | // bw.Write(data); | ||
625 | // bw.Close(); | ||
626 | // fs.Close(); | ||
627 | //} | ||
607 | private void SaveAssetToFile(string filename, byte[] data) | 628 | private void SaveAssetToFile(string filename, byte[] data) |
608 | { | 629 | { |
609 | FileStream fs = File.Create(filename); | 630 | string assetPath = "UserAssets"; |
631 | if (!Directory.Exists(assetPath)) | ||
632 | { | ||
633 | Directory.CreateDirectory(assetPath); | ||
634 | } | ||
635 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
610 | BinaryWriter bw = new BinaryWriter(fs); | 636 | BinaryWriter bw = new BinaryWriter(fs); |
611 | bw.Write(data); | 637 | bw.Write(data); |
612 | bw.Close(); | 638 | bw.Close(); |
@@ -693,10 +719,23 @@ namespace OpenSim.Region.Capabilities | |||
693 | // XXX Maybe this should be some meaningful error packet | 719 | // XXX Maybe this should be some meaningful error packet |
694 | return null; | 720 | return null; |
695 | } | 721 | } |
696 | 722 | ///Left this in and commented in case there are unforseen issues | |
723 | //private void SaveAssetToFile(string filename, byte[] data) | ||
724 | //{ | ||
725 | // FileStream fs = File.Create(filename); | ||
726 | // BinaryWriter bw = new BinaryWriter(fs); | ||
727 | // bw.Write(data); | ||
728 | // bw.Close(); | ||
729 | // fs.Close(); | ||
730 | //} | ||
697 | private void SaveAssetToFile(string filename, byte[] data) | 731 | private void SaveAssetToFile(string filename, byte[] data) |
698 | { | 732 | { |
699 | FileStream fs = File.Create(filename); | 733 | string assetPath = "UserAssets"; |
734 | if (!Directory.Exists(assetPath)) | ||
735 | { | ||
736 | Directory.CreateDirectory(assetPath); | ||
737 | } | ||
738 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
700 | BinaryWriter bw = new BinaryWriter(fs); | 739 | BinaryWriter bw = new BinaryWriter(fs); |
701 | bw.Write(data); | 740 | bw.Write(data); |
702 | bw.Close(); | 741 | bw.Close(); |
@@ -704,4 +743,4 @@ namespace OpenSim.Region.Capabilities | |||
704 | } | 743 | } |
705 | } | 744 | } |
706 | } | 745 | } |
707 | } \ No newline at end of file | 746 | } |