/*
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Peter Hofer <ph@desktopbsd.net>
 *			(C) 2004, 2005
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */

#include <dbsdglobal.h>

#include <qfileinfo.h>

DBSDIconLoader  *DBSDGlobal::iconLoader = 0;
int DBSDGlobal::nativeDesktopBSD = -1;

/**
  * This method determines if the program is run in a
  * "native" DesktopBSD environment and can be used to
  * find out whether certain features should be enabled
  * or disabled because of system requirements (such as
  * permissions).
  *
  * @return TRUE When run natively under DesktopBSD,
  *         otherwise false.
  *
  */
bool DBSDGlobal::isNativeDesktopBSD() {
	if(nativeDesktopBSD == -1) {
		const QString kernConf = "/usr/src/sys/%1/conf/DESKTOPBSD";

		nativeDesktopBSD = QFileInfo("/usr/local/share/desktopbsd/release").exists() ||
								 (QFileInfo(kernConf.arg("i386")).exists() &&
								  QFileInfo(kernConf.arg("amd64")).exists());
	}
	
	return nativeDesktopBSD;
}
