dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO/IsolatedStorage Is


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO/IsolatedStorage IsolatedStorageFile.cs, 1.5, 1.6
Date: Tue, 19 Aug 2003 01:43:35 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/IsolatedStorage
In directory subversions:/tmp/cvs-serv8795/runtime/System/IO/IsolatedStorage

Modified Files:
        IsolatedStorageFile.cs 
Log Message:


Create the isolated storage area under "$HOME/.cli/isolated-storage".


Index: IsolatedStorageFile.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/IsolatedStorage/IsolatedStorageFile.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** IsolatedStorageFile.cs      29 May 2003 05:38:18 -0000      1.5
--- IsolatedStorageFile.cs      19 Aug 2003 05:43:33 -0000      1.6
***************
*** 26,37 ****
  
  using System.Collections;
  using System.Security;
  using System.Security.Permissions;
  using System.Security.Policy;
  using System.Text;
  
  // Note: see the general comments in "IsolatedStorage.cs".
  
- [TODO]
  public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable
  {
--- 26,38 ----
  
  using System.Collections;
+ using System.Reflection;
  using System.Security;
  using System.Security.Permissions;
  using System.Security.Policy;
  using System.Text;
+ using Platform;
  
  // Note: see the general comments in "IsolatedStorage.cs".
  
  public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable
  {
***************
*** 273,281 ****
  
        // Get the base directory for an isolated storage scope.
-       [TODO]
        private static String GetBaseDirectory(IsolatedStorageScope scope)
                        {
!                               // TODO
!                               throw new 
SecurityException(_("IO_IsolatedPermissions"));
                        }
  
--- 274,346 ----
  
        // Get the base directory for an isolated storage scope.
        private static String GetBaseDirectory(IsolatedStorageScope scope)
                        {
!                               // Find the base directory to start with.
!                               String baseDir;
!                               if(InfoMethods.GetPlatformID() == 
PlatformID.Unix)
!                               {
!                                       // Use the home directory under Unix 
systems.
!                                       baseDir = 
Environment.GetEnvironmentVariable("HOME");
!                                       if(baseDir == null || baseDir.Length == 
0)
!                                       {
!                                               return null;
!                                       }
!                                       baseDir = Path.Combine(baseDir, ".cli");
!                               }
!                               else if((scope & IsolatedStorageScope.Roaming) 
!= 0)
!                               {
!                                       // Use the roaming application data 
area under Win32.
!                                       try
!                                       {
!                                               baseDir = 
Environment.GetFolderPath
!                                                       
(Environment.SpecialFolder.ApplicationData);
!                                       }
!                                       catch(Exception)
!                                       {
!                                               return null;
!                                       }
!                               }
!                               else
!                               {
!                                       // Use the non-roaming application data 
area under Win32.
!                                       try
!                                       {
!                                               baseDir = 
Environment.GetFolderPath
!                                                       
(Environment.SpecialFolder.LocalApplicationData);
!                                       }
!                                       catch(Exception)
!                                       {
!                                               return null;
!                                       }
!                               }
!                               if(baseDir == null || baseDir.Length == 0)
!                               {
!                                       return null;
!                               }
!                               baseDir = Path.Combine(baseDir, 
"isolated-storage");
! 
!                               // Add the assembly sub-directory name.
!                               if((scope & IsolatedStorageScope.Assembly) != 0)
!                               {
!                                       String name = 
Assembly.GetEntryAssembly().FullName;
!                                       int index = name.IndexOf(',');
!                                       if(index != -1)
!                                       {
!                                               name = name.Substring(0, index);
!                                       }
!                                       baseDir = Path.Combine(baseDir, name);
!                               }
!                               else
!                               {
!                                       baseDir = Path.Combine(baseDir, 
"default");
!                               }
! 
!                               // Add the domain sub-directory name.
!                               if((scope & IsolatedStorageScope.Domain) != 0)
!                               {
!                                       baseDir = Path.Combine
!                                               (baseDir, 
AppDomain.CurrentDomain.ToString());
!                               }
!                               return baseDir;
                        }
  
***************
*** 299,302 ****
--- 364,372 ----
                                        // check that the caller has sufficient 
permissions.
                                        String baseDirectory = 
GetBaseDirectory(scope);
+                                       if(baseDirectory == null)
+                                       {
+                                               throw new 
IsolatedStorageException
+                                                       
(_("IO_IsolatedStorage"));
+                                       }
  
                                        // Make sure that the directory exists, 
because





reply via email to

[Prev in Thread] Current Thread [Next in Thread]