view Constants.cs @ 112:3262c0ad2d3d

* Fix hasty SimpleSet change
author IBBoard <dev@ibboard.co.uk>
date Tue, 31 Jan 2012 20:46:10 +0000
parents 27b6aa1e98e8
children e9f3a4ddf772
line wrap: on
line source

// This file (Constants.cs) is a part of the IBBoard library and is copyright 2009 IBBoard.
//
// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.

using System;
using System.IO;

namespace IBBoard
{
	/// <summary>
	/// Summary description for Constants.
	/// </summary>
	public class Constants
	{
		public static readonly char DirectoryChar = Path.DirectorySeparatorChar;
		public static readonly string DirectoryString = Path.DirectorySeparatorChar.ToString();
		private static string executablePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(DirectoryChar);

		static Constants()
		{
            string appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
			string exe = Environment.GetCommandLineArgs()[0];
			exe = Path.GetFileNameWithoutExtension(exe);
            userDataPath = Path.Combine(Path.Combine(appDataDir, "IBBoard"), exe);
		}

		/// <summary>
		/// Gets the path of the directory that contains the executable.
		/// </summary>
		/// <value>
		/// The path that the executable is in.
		/// </value>
		public static string ExecutablePath
		{
			get { return executablePath; }
		}
		
		private static string userDataPath;

		/// <summary>
		/// Gets the standard user data path for this app. This follows a convention of using the app name for the folder
		/// and putting it in a folder called "IBBoard" to avoid collisions.
		/// </summary>
		/// <value>
		/// The user data path, following the IBBoard convention.
		/// </value>
		public static string UserDataPath
		{
			get { return userDataPath; }
		}
	}
}