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(); }
/** * 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(); }
/** * Changes game resource path * * @param path New path to game resources */ void violet::FileUtility::setResourcePath(boost::filesystem::path const& path) { m_resPath = path; traceResPath(); }
void FileUtility::setFullResPath(std::string path) { m_resPath = path; traceResPath(); }