// // app-wide settings; assumed constant after options have been read in. // using System; using System.Collections; namespace HsWrap { public class Config { static private bool m_verbose; static private bool m_withTypeModule; static private bool m_dryRunMode; static private bool m_interactiveMode; static private String m_outDir; static private System.Collections.ArrayList m_searchDir; static Config() { m_verbose = false; m_withTypeModule = true; m_dryRunMode = false; m_interactiveMode = true; m_outDir = ""; m_searchDir = new System.Collections.ArrayList(); } public static bool Verbose { get { return m_verbose; } set { m_verbose = value; } } public static bool WithTypeModule { get { return m_withTypeModule; } set { m_withTypeModule = value; } } public static bool DryRunMode { get { return m_dryRunMode; } set { m_dryRunMode = value; } } public static bool InteractiveMode { get { return m_interactiveMode; } set { m_interactiveMode = value; } } public static String OutputDir { get { return m_outDir; } set { m_outDir = value; } } public static void AddSearchDir(String d) { if ( !System.IO.Directory.Exists(d) ) { Console.WriteLine("WARNING: search dir {0} doesn't exist (CWD={1}); ignoring", d, System.IO.Directory.GetCurrentDirectory()); } else { m_searchDir.Add(d); } } public static bool FileExists(String f) { // Console.WriteLine("IO=> exists? {0}", f); if ( System.IO.File.Exists(f) || System.IO.File.Exists(f+".hs") ) { return true; } foreach(String d in m_searchDir) { String fn = d + '\\' + f; // Console.WriteLine("IO=> exists? {0}", fn); if ( System.IO.File.Exists(fn) || System.IO.File.Exists(f+".hs") ) { return true; } } return false; } }; }