Feature added: Allow user to change the persistence location
This commit is contained in:
@@ -31,8 +31,18 @@ namespace Novell.CASA.CASAPolicy
|
||||
{
|
||||
public class ICASAPol
|
||||
{
|
||||
static string GetPolicyFilePath()
|
||||
static string GetPolicyFilePath()
|
||||
{
|
||||
return GetPolicyFilePath(null);
|
||||
}
|
||||
|
||||
static string GetPolicyFilePath(string sUserDir)
|
||||
{
|
||||
if (sUserDir != null)
|
||||
{
|
||||
return sUserDir + XmlConsts.policyFileName;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
/* There needs to be a better way to get the HOME dir,
|
||||
@@ -313,15 +323,21 @@ public class ICASAPol
|
||||
return linkKey;
|
||||
}
|
||||
|
||||
static public CASAPol GetPolicy(CASAPolType policyType)
|
||||
|
||||
static public CASAPol GetPolicy(CASAPolType policyType)
|
||||
{
|
||||
return GetPolicy(policyType, null);
|
||||
}
|
||||
|
||||
static public CASAPol GetPolicy(CASAPolType policyType, string sDir)
|
||||
{
|
||||
CASAPol pol = null;
|
||||
try
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
if(!File.Exists(GetPolicyFilePath()))
|
||||
if(!File.Exists(GetPolicyFilePath(sDir)))
|
||||
return null;
|
||||
doc.Load(GetPolicyFilePath());
|
||||
doc.Load(GetPolicyFilePath(sDir));
|
||||
switch(policyType)
|
||||
{
|
||||
case CASAPolType.AGGREGATION_POL:
|
||||
@@ -348,7 +364,7 @@ public class ICASAPol
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
//Console.WriteLine(e.ToString());
|
||||
System.Diagnostics.Trace.WriteLine("POLICY: " + e.ToString());
|
||||
}
|
||||
return pol;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user