* Take another attempt at http://opensimulator.org/mantis/view.php?id=3191
* Return something more sensible if a file isn't found0.6.6-post-fixes
parent
14f0d5e77f
commit
01ca3a91ad
|
@ -422,8 +422,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
/// Resolve path to a working FileStream
|
||||
/// </summary>
|
||||
private Stream GetStream(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
|
@ -431,7 +429,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
}
|
||||
else
|
||||
{
|
||||
Uri uri = new Uri(path); // throw exception if not valid URI
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri(path);
|
||||
if (uri.Scheme == "file")
|
||||
{
|
||||
return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read);
|
||||
|
@ -446,10 +446,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
return URIFetch(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (UriFormatException)
|
||||
{
|
||||
throw new Exception(String.Format("Unable to create file input stream for {0}: {1}", path, e.Message));
|
||||
// In many cases the user will put in a plain old filename that cannot be found so assume that
|
||||
// this is the problem rather than confusing the issue with a UriFormatException
|
||||
throw new Exception(String.Format("Cannot find file {0}", path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue