예제 #1
0
FileUtility::FileUtility(char *argPath) {
#ifdef _WIN32
	m_appPath = argPath;
	m_appPath = m_appPath.parent_path();
	m_resPath = m_appPath;
	m_usrPath = m_resPath;
#endif //_WIN32
#if defined linux || defined __FreeBSD__ || defined __OpenBSD__
#ifndef INSTALL_PREFIX
#define INSTALL_PREFIX "/usr/local";
#endif //INSTALL_PREFIX
	m_appPath = INSTALL_PREFIX;
	m_appPath /= "bin";
#ifndef DATA_INSTALL_DIR
	m_resPath = m_appPath;
	m_resPath /= "../share/violetland";
#else //DATA_INSTALL_DIR
	m_resPath = DATA_INSTALL_DIR;
#endif //DATA_INSTALL_DIR
	m_usrPath = getenv("HOME");
	m_usrPath /= ".config";
	mkdir(m_usrPath.string().c_str(), S_IRWXU | S_IRGRP | S_IROTH);
	m_usrPath /= "violetland";
	mkdir(m_usrPath.string().c_str(), S_IRWXU | S_IRGRP | S_IROTH);
#endif //linux || __FreeBSD__
	traceResPath();
}
예제 #2
0
/**
 * Constructor
 * 
 * @param resources Path to game resources (common to all users)
 * @param user Path to user resources
 */
violet::FileUtility::FileUtility(
			const boost::filesystem::path& resources,
			const boost::filesystem::path& user
		) :	m_resPath(resources),
			m_usrPath(user) {
	
	traceResPath();
}
예제 #3
0
/**
 * Changes game resource path
 * 
 * @param path New path to game resources
 */
void violet::FileUtility::setResourcePath(boost::filesystem::path const& path) {
	m_resPath = path;
	traceResPath();
}
예제 #4
0
void FileUtility::setFullResPath(std::string path) {
	m_resPath = path;
	traceResPath();
}