- lots of updates including:
- cmake system changes (after doing a make you may go: sudo make install to install in standard linux paths) - updates to various pathing in order to more robustly support lhs *WARNING, Linux dev's should run cmake like the following to avoid pathing issues as the default now is lhs paths: cmake -DCMAKE_INSTALL_PREFIX= .. (notice the SPACE before the ..)
This commit is contained in:
parent
e4f0e8bfbf
commit
fab36598b1
|
@ -74,10 +74,25 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
|||
SET(SVN_VERSION_CMD "-DSVNVERSION='\\\"`svnversion -n ${PROJECT_SOURCE_DIR}`\\\"'")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SVN_VERSION_CMD}")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SVN_VERSION_CMD}")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SVN_VERSION_CMD}")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${SVN_VERSION_CMD}")
|
||||
IF(CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
#SET(MEGAGLEST_BIN_INSTALL_PATH "")
|
||||
#SET(MEGAGLEST_DATA_INSTALL_PATH "")
|
||||
|
||||
MESSAGE(STATUS "*NOTE: NOT USING a Custom Data Install Path...")
|
||||
ELSE()
|
||||
SET(MEGAGLEST_BIN_INSTALL_PATH "bin/")
|
||||
SET(MEGAGLEST_DATA_INSTALL_PATH "share/megaglest/")
|
||||
SET(CUSTOM_DATA_INSTALL_PATH "'\\\"${CMAKE_INSTALL_PREFIX}/${MEGAGLEST_DATA_INSTALL_PATH}\\\"'")
|
||||
SET(CUSTOM_DATA_INSTALL_PATH_VALUE "-DCUSTOM_DATA_INSTALL_PATH=${CUSTOM_DATA_INSTALL_PATH}")
|
||||
|
||||
MESSAGE(STATUS "*NOTE: Custom Data Install Path is [${CUSTOM_DATA_INSTALL_PATH}]")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||
|
||||
# We do some funky character escaping to get the right stuff written out to
|
||||
# the final Makefile so we get the SVN Global Revsion #
|
||||
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" standalone="yes"?>
|
||||
<configuration>
|
||||
<title value="MegaGlest"/>
|
||||
<file-name-main value="glest.ini"/>
|
||||
<file-name-main value="$APPLICATIONDATAPATH/glest.ini"/>
|
||||
<file-name value="$HOME/.megaglest/glestuser.ini"/>
|
||||
<icon value="true" path="glest.ico"/>
|
||||
<icon value="true" path="$APPLICATIONDATAPATH/glest.ico"/>
|
||||
<field-groups>
|
||||
<field-group name="General">
|
||||
<field type="Int">
|
||||
|
@ -358,16 +358,6 @@ system instead of a styled 3D mouse pointer."/>
|
|||
<enum value="false"/>
|
||||
</enums>
|
||||
</field>
|
||||
<field type="Enum">
|
||||
<name value="Client and Server data file transfer support"/>
|
||||
<variable-name value="AllowDownloadDataSynch"/>
|
||||
<description value=""/>
|
||||
<default value="false"/>
|
||||
<enums>
|
||||
<enum value="true"/>
|
||||
<enum value="false"/>
|
||||
</enums>
|
||||
</field>
|
||||
<field type="Enum">
|
||||
<name value="Enable Network Debugging Output"/>
|
||||
<variable-name value="DebugNetwork"/>
|
||||
|
|
|
@ -19,7 +19,8 @@ ColorBits=32
|
|||
ConsoleMaxLines=7
|
||||
ConsoleMaxLinesStored=20
|
||||
ConsoleTimeout=20
|
||||
DataPath=$APPLICATIONPATH/
|
||||
DataPath=$APPLICATIONDATAPATH/
|
||||
LogPath=$HOME/.megaglest/
|
||||
DayTime=1000
|
||||
DebugLogFile=debug.log
|
||||
DebugMode=false
|
||||
|
|
|
@ -59,6 +59,7 @@ SET(DIRS_WITH_SRC
|
|||
.
|
||||
)
|
||||
|
||||
SET(GLEST_MAIN_INCLUDE_ROOT "../glest_game/")
|
||||
SET(GLEST_LIB_INCLUDE_ROOT "../shared_lib/include/")
|
||||
|
||||
SET(GLEST_LIB_INCLUDE_DIRS
|
||||
|
@ -71,10 +72,14 @@ SET(GLEST_LIB_INCLUDE_DIRS
|
|||
${GLEST_LIB_INCLUDE_ROOT}map
|
||||
${GLEST_LIB_INCLUDE_ROOT}sound
|
||||
${GLEST_LIB_INCLUDE_ROOT}xml
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop
|
||||
${GLEST_MAIN_INCLUDE_ROOT}facilities
|
||||
${GLEST_MAIN_INCLUDE_ROOT}game
|
||||
${GLEST_MAIN_INCLUDE_ROOT}global
|
||||
)
|
||||
INCLUDE_DIRECTORIES( ${GLEST_LIB_INCLUDE_DIRS} )
|
||||
|
||||
SET(MG_SOURCE_FILES "")
|
||||
SET(MG_SOURCE_FILES "../glest_game/global/config.cpp")
|
||||
|
||||
FOREACH(DIR IN LISTS DIRS_WITH_SRC)
|
||||
INCLUDE_DIRECTORIES( ${DIR} )
|
||||
|
@ -107,10 +112,25 @@ SET_SOURCE_FILES_PROPERTIES(${MG_INCLUDE_FILES} PROPERTIES HEADER_FILE_ONLY 1)
|
|||
ADD_EXECUTABLE(${TARGET_NAME} ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
|
||||
IF(WIN32)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
ELSE()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
ENDIF()
|
||||
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
DESTINATION ${MEGAGLEST_BIN_INSTALL_PATH})
|
||||
|
||||
# Installation of the program config and image files
|
||||
INSTALL(FILES
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glest.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glestkeys.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/configuration.xml"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glest.ico"
|
||||
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
|
||||
ENDIF()
|
||||
|
|
|
@ -61,7 +61,7 @@ void Configuration::loadStructure(const string &path){
|
|||
//icon
|
||||
XmlNode *iconNode= configurationNode->getChild("icon");
|
||||
icon= iconNode->getAttribute("value")->getBoolValue();
|
||||
if(icon){
|
||||
if(icon) {
|
||||
iconPath= iconNode->getAttribute("path")->getValue();
|
||||
Properties::applyTagsToValue(iconPath);
|
||||
}
|
||||
|
|
|
@ -7,16 +7,39 @@
|
|||
#include <wx/image.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/icon.h>
|
||||
#include "platform_common.h"
|
||||
#include "config.h"
|
||||
#include "game_constants.h"
|
||||
#include "util.h"
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Shared::PlatformCommon;
|
||||
using namespace Glest::Game;
|
||||
using namespace Shared::Util;
|
||||
|
||||
namespace Configurator{
|
||||
namespace Glest { namespace Game {
|
||||
string getGameReadWritePath(string lookupKey) {
|
||||
string path = "";
|
||||
if(path == "" && getenv("GLESTHOME") != NULL) {
|
||||
path = getenv("GLESTHOME");
|
||||
if(path != "" && EndsWith(path, "/") == false && EndsWith(path, "\\") == false) {
|
||||
path += "/";
|
||||
}
|
||||
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path to be used for read/write files [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}}
|
||||
|
||||
namespace Configurator {
|
||||
|
||||
// ===============================================
|
||||
// class MainWindow
|
||||
// ===============================================
|
||||
|
||||
|
||||
const int MainWindow::margin= 10;
|
||||
const int MainWindow::panelMargin= 20;
|
||||
const int MainWindow::gridMarginHorizontal= 30;
|
||||
|
@ -24,26 +47,30 @@ const int MainWindow::gridMarginHorizontal= 30;
|
|||
const string MainWindow::versionString= "v1.3.5";
|
||||
const string MainWindow::winHeader= "Mega-Glest config " + versionString + " - Built: " + __DATE__;
|
||||
|
||||
MainWindow::MainWindow() :
|
||||
MainWindow::MainWindow(string appPath) :
|
||||
wxFrame(
|
||||
NULL, -1, Configuration::ToUnicode(winHeader),
|
||||
wxDefaultPosition, wxSize(800, 600)){
|
||||
|
||||
SetExtraStyle(wxFRAME_EX_CONTEXTHELP);
|
||||
|
||||
configuration.load("configuration.xml");
|
||||
this->appPath = appPath;
|
||||
Properties::setApplicationPath(executable_path(appPath));
|
||||
Config &config = Config::getInstance();
|
||||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
configuration.load(iniFilePath + "configuration.xml");
|
||||
|
||||
//Create(NULL, -1, "", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxSYSTEM_MENU);
|
||||
|
||||
SetTitle(Configuration::ToUnicode(("Configurator - " + configuration.getTitle() + " - Editing " + configuration.getFileName()).c_str()));
|
||||
|
||||
if(configuration.getIcon()){
|
||||
|
||||
printf("In [%s::%s] icon = [%s]\n",__FILE__,__FUNCTION__,configuration.getIconPath().c_str());
|
||||
if(configuration.getIcon()) {
|
||||
string iconPath = configuration.getIconPath();
|
||||
printf("In [%s::%s] icon = [%s]\n",__FILE__,__FUNCTION__,iconPath.c_str());
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
wxIcon icon;
|
||||
icon.LoadFile(Configuration::ToUnicode(configuration.getIconPath().c_str()), wxBITMAP_TYPE_ICO);
|
||||
icon.LoadFile(Configuration::ToUnicode(iconPath.c_str()), wxBITMAP_TYPE_ICO);
|
||||
SetIcon(icon);
|
||||
}
|
||||
|
||||
|
@ -180,8 +207,19 @@ END_EVENT_TABLE()
|
|||
// ===============================================
|
||||
|
||||
bool App::OnInit(){
|
||||
try{
|
||||
mainWindow= new MainWindow();
|
||||
try {
|
||||
SystemFlags::VERBOSE_MODE_ENABLED = true;
|
||||
string appPath = "";
|
||||
wxString exe_path = wxStandardPaths::Get().GetExecutablePath();
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
#endif
|
||||
|
||||
mainWindow= new MainWindow(appPath);
|
||||
mainWindow->Show();
|
||||
}
|
||||
catch(const exception &e){
|
||||
|
|
|
@ -49,8 +49,10 @@ private:
|
|||
wxNotebook *notebook;
|
||||
wxTextCtrl *infoText;
|
||||
|
||||
string appPath;
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
MainWindow(string appPath);
|
||||
void init();
|
||||
static const string versionString;
|
||||
static const string winHeader;
|
||||
|
|
|
@ -114,9 +114,23 @@ SET_SOURCE_FILES_PROPERTIES(${MG_INCLUDE_FILES} PROPERTIES HEADER_FILE_ONLY 1)
|
|||
ADD_EXECUTABLE(${TARGET_NAME} ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
|
||||
IF(WIN32)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
ELSE()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
DESTINATION ${MEGAGLEST_BIN_INSTALL_PATH})
|
||||
|
||||
# Installation of the program config and image files
|
||||
INSTALL(FILES
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glest.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glestkeys.ini"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/g3dviewer.ico"
|
||||
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
|
||||
ENDIF()
|
||||
|
|
|
@ -218,6 +218,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
Properties::setApplicationPath(executable_path(appPath));
|
||||
|
||||
Config &config = Config::getInstance();
|
||||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
//getGlPlatformExtensions();
|
||||
|
||||
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 }; // to prevent flicker
|
||||
|
@ -330,10 +331,11 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
|
||||
#else
|
||||
wxIcon icon;
|
||||
std::ifstream testFile("g3dviewer.ico");
|
||||
string icon_file = iniFilePath + "g3dviewer.ico";
|
||||
std::ifstream testFile(icon_file.c_str());
|
||||
if(testFile.good()) {
|
||||
testFile.close();
|
||||
icon.LoadFile(wxT("g3dviewer.ico"),wxBITMAP_TYPE_ICO);
|
||||
icon.LoadFile(ToUnicode(icon_file.c_str()),wxBITMAP_TYPE_ICO);
|
||||
}
|
||||
#endif
|
||||
SetIcon(icon);
|
||||
|
@ -1797,7 +1799,9 @@ END_EVENT_TABLE()
|
|||
// class App
|
||||
// ===============================================
|
||||
|
||||
bool App::OnInit(){
|
||||
bool App::OnInit() {
|
||||
SystemFlags::VERBOSE_MODE_ENABLED = true;
|
||||
|
||||
string modelPath="";
|
||||
string particlePath="";
|
||||
string projectileParticlePath="";
|
||||
|
|
|
@ -185,52 +185,39 @@ IF(WIN32)
|
|||
TARGET_LINK_LIBRARIES(${TARGET_NAME} stdc++ gcc odbc32 wsock32 winspool winmm shell32 comctl32 ctl3d32 advapi32 wsock32 opengl32 glu32 ole32 oleaut32 uuid mingw32 ddraw dsound dxguid ws2_32 iphlpapi wsock32 libogg libvorbis libvorbisfile zlib jpeg libpng xerces-c2_8_0 OpenAL32 libcurl winmm gdi32 opengl32 glu32 SDL SDLmain lua5.1 streflop libmegaglest stdc++ moldname mingwex msvcrt user32 kernel32)
|
||||
ENDIF()
|
||||
IF(NOT WIN32)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
|
||||
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
DESTINATION bin/megaglest)
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
DESTINATION ${MEGAGLEST_BIN_INSTALL_PATH})
|
||||
|
||||
# Installation of the program config and image files
|
||||
INSTALL(FILES
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glest.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glestkeys.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/megaglest.bmp"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/megaglest.ico"
|
||||
DESTINATION bin/megaglest)
|
||||
# Installation of the program config and image files
|
||||
INSTALL(FILES
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glest.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glestkeys.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/megaglest.bmp"
|
||||
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
|
||||
|
||||
# Installation of the tools
|
||||
#INSTALL(TARGETS
|
||||
# "${PROJECT_SOURCE_DIR}/mk/linux/megaglest_configurator"
|
||||
# "${PROJECT_SOURCE_DIR}/mk/linux/megaglest_editor"
|
||||
# "${PROJECT_SOURCE_DIR}/mk/linux/megaglest_g3dviewer"
|
||||
# DESTINATION bin/megaglest)
|
||||
|
||||
# Installation of the program config and image files
|
||||
#INSTALL(FILES
|
||||
# "${PROJECT_SOURCE_DIR}/mk/linux/g3dviewer.ico"
|
||||
# "${PROJECT_SOURCE_DIR}/mk/linux/editor.ico"
|
||||
# "${PROJECT_SOURCE_DIR}/mk/linux/configuration.xml"
|
||||
# DESTINATION bin/megaglest)
|
||||
|
||||
# Installation of data files from outside normal data folder
|
||||
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/source/masterserver/flags"
|
||||
DESTINATION share/megaglest/data/core/misc_textures
|
||||
OPTIONAL REGEX "/.svn" EXCLUDE)
|
||||
|
||||
# Installation of the data
|
||||
install(
|
||||
DIRECTORY "${PROJECT_SOURCE_DIR}/data/glest_game/data"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/docs"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/maps"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/scenarios"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/techs"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/tilesets"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/tutorials"
|
||||
DESTINATION share/megaglest
|
||||
OPTIONAL REGEX "/.svn" EXCLUDE)
|
||||
# Installation of data files from outside normal data folder
|
||||
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/source/masterserver/flags"
|
||||
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH}data/core/misc_textures
|
||||
OPTIONAL REGEX "/.svn" EXCLUDE)
|
||||
|
||||
# Installation of the data
|
||||
install(
|
||||
DIRECTORY "${PROJECT_SOURCE_DIR}/data/glest_game/data"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/docs"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/maps"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/scenarios"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/techs"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/tilesets"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/tutorials"
|
||||
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH}
|
||||
OPTIONAL REGEX "/.svn" EXCLUDE)
|
||||
ENDIF()
|
||||
|
|
|
@ -86,6 +86,24 @@ Config::Config() {
|
|||
fileLoaded.second = false;
|
||||
}
|
||||
|
||||
bool Config::tryCustomPath(std::pair<ConfigType,ConfigType> &type, std::pair<string,string> &file, string custom_path) {
|
||||
bool wasFound = false;
|
||||
if((type.first == cfgMainGame && type.second == cfgUserGame &&
|
||||
file.first == glest_ini_filename && file.second == glestuser_ini_filename) ||
|
||||
(type.first == cfgMainKeys && type.second == cfgUserKeys &&
|
||||
file.first == glestkeys_ini_filename && file.second == glestuserkeys_ini_filename)) {
|
||||
|
||||
string linuxPath = custom_path;
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("-=-=-=-=-=-=-= looking for file in possible location [%s]\n",linuxPath.c_str());
|
||||
if(fileExists(linuxPath + file.first) == true) {
|
||||
file.first = linuxPath + file.first;
|
||||
file.second = linuxPath + file.second;
|
||||
wasFound = true;
|
||||
}
|
||||
}
|
||||
return wasFound;
|
||||
}
|
||||
|
||||
Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> file, std::pair<bool,bool> fileMustExist) {
|
||||
fileLoaded.first = false;
|
||||
fileLoaded.second = false;
|
||||
|
@ -97,39 +115,21 @@ Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> f
|
|||
fileName.first = getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) + fileName.first;
|
||||
fileName.second = getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) + fileName.second;
|
||||
}
|
||||
// Look in standard linux shared paths for ini files
|
||||
|
||||
bool foundPath = false;
|
||||
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
||||
foundPath = tryCustomPath(cfgType, fileName, CUSTOM_DATA_INSTALL_PATH);
|
||||
#endif
|
||||
// Look in standard linux shared paths for ini files
|
||||
#if defined(__linux__)
|
||||
else if(cfgType.first == cfgMainGame && cfgType.second == cfgUserGame &&
|
||||
fileName.first == glest_ini_filename && fileName.second == glestuser_ini_filename) {
|
||||
string linuxPath = "/usr/share/megaglest/";
|
||||
if(fileExists(linuxPath + fileName.first) == true) {
|
||||
fileName.first = linuxPath + fileName.first;
|
||||
fileName.second = linuxPath + fileName.second;
|
||||
}
|
||||
else {
|
||||
linuxPath = "/usr/local/share/megaglest/";
|
||||
if(fileExists(linuxPath + fileName.first) == true) {
|
||||
fileName.first = linuxPath + fileName.first;
|
||||
fileName.second = linuxPath + fileName.second;
|
||||
}
|
||||
}
|
||||
if(foundPath == false) {
|
||||
foundPath = tryCustomPath(cfgType, fileName, "/usr/share/megaglest/");
|
||||
}
|
||||
else if(cfgType.first == cfgMainKeys && cfgType.second == cfgUserKeys &&
|
||||
fileName.first == glestkeys_ini_filename && fileName.second == glestuserkeys_ini_filename) {
|
||||
string linuxPath = "/usr/share/megaglest/";
|
||||
if(fileExists(linuxPath + fileName.first) == true) {
|
||||
fileName.first = linuxPath + fileName.first;
|
||||
fileName.second = linuxPath + fileName.second;
|
||||
}
|
||||
else {
|
||||
linuxPath = "/usr/local/share/megaglest/";
|
||||
if(fileExists(linuxPath + fileName.first) == true) {
|
||||
fileName.first = linuxPath + fileName.first;
|
||||
fileName.second = linuxPath + fileName.second;
|
||||
}
|
||||
}
|
||||
if(foundPath == false) {
|
||||
foundPath = tryCustomPath(cfgType, fileName, "/usr/local/share/megaglest/");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(fileMustExist.first == true && fileExists(fileName.first) == false) {
|
||||
string currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
|
||||
fileName.first = currentpath + fileName.first;
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
protected:
|
||||
Config();
|
||||
Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> file, std::pair<bool,bool> fileMustExist);
|
||||
|
||||
bool tryCustomPath(std::pair<ConfigType,ConfigType> &type, std::pair<string,string> &file, string custom_path);
|
||||
static void CopyAll(Config *src,Config *dest);
|
||||
vector<pair<string,string> > getPropertiesFromContainer(const Properties &propertiesObj) const;
|
||||
|
||||
|
|
|
@ -2721,10 +2721,11 @@ int glestMainWrapper(int argc, char** argv) {
|
|||
//#endif
|
||||
#endif
|
||||
|
||||
application_binary= executable_path(argv[0],true);
|
||||
#ifdef WIN32_STACK_TRACE
|
||||
__try {
|
||||
#endif
|
||||
application_binary= executable_path(argv[0],true);
|
||||
//application_binary= executable_path(argv[0],true);
|
||||
//printf("\n\nargv0 [%s] application_binary [%s]\n\n",argv[0],application_binary.c_str());
|
||||
|
||||
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)
|
||||
|
|
|
@ -115,9 +115,23 @@ ENDIF()
|
|||
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
|
||||
IF(WIN32)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
ELSE()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
DESTINATION ${MEGAGLEST_BIN_INSTALL_PATH})
|
||||
|
||||
# Installation of the program config and image files
|
||||
INSTALL(FILES
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glest.ini"
|
||||
"${PROJECT_SOURCE_DIR}/mk/linux/glestkeys.ini"
|
||||
"${PROJECT_SOURCE_DIR}/data/glest_game/editor.ico"
|
||||
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
|
||||
ENDIF()
|
||||
|
|
|
@ -338,33 +338,36 @@ void MainWindow::init(string fname) {
|
|||
toolbar2->AddTool(miRadius + 9, _("radius9"), wxBitmap(radius_9), _("9 (17x17)"));
|
||||
toolbar2->Realize();
|
||||
|
||||
Config &config = Config::getInstance();
|
||||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
string userData = config.getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
endPathWithSlash(userData);
|
||||
}
|
||||
|
||||
//std::cout << "A" << std::endl;
|
||||
wxInitAllImageHandlers();
|
||||
#ifdef WIN32
|
||||
//std::cout << "B" << std::endl;
|
||||
#if defined(__MINGW32__)
|
||||
wxIcon icon(ToUnicode("IDI_ICON1"));
|
||||
#else
|
||||
wxIcon icon("IDI_ICON1");
|
||||
#endif
|
||||
#if defined(__MINGW32__)
|
||||
wxIcon icon(ToUnicode("IDI_ICON1"));
|
||||
#else
|
||||
wxIcon icon("IDI_ICON1");
|
||||
#endif
|
||||
|
||||
#else
|
||||
//std::cout << "B" << std::endl;
|
||||
wxIcon icon;
|
||||
std::ifstream testFile("editor.ico");
|
||||
string icon_file = iniFilePath + "editor.ico";
|
||||
std::ifstream testFile(icon_file.c_str());
|
||||
if(testFile.good()) {
|
||||
testFile.close();
|
||||
icon.LoadFile(wxT("editor.ico"),wxBITMAP_TYPE_ICO);
|
||||
icon.LoadFile(ToUnicode(icon_file.c_str()),wxBITMAP_TYPE_ICO);
|
||||
}
|
||||
#endif
|
||||
//std::cout << "C" << std::endl;
|
||||
SetIcon(icon);
|
||||
fileDialog = new wxFileDialog(this);
|
||||
Config &config = Config::getInstance();
|
||||
string userData = config.getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
endPathWithSlash(userData);
|
||||
}
|
||||
string defaultPath = userData + "maps/";
|
||||
fileDialog->SetDirectory(ToUnicode(defaultPath));
|
||||
|
||||
|
@ -1387,6 +1390,8 @@ bool SimpleDialog::show(const string &title, bool wide) {
|
|||
// ===============================================
|
||||
|
||||
bool App::OnInit() {
|
||||
SystemFlags::VERBOSE_MODE_ENABLED = true;
|
||||
|
||||
string fileparam;
|
||||
if(argc==2){
|
||||
if(argv[1][0]=='-') { // any flag gives help and exits program.
|
||||
|
|
|
@ -66,14 +66,24 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
|
|||
int resH = PlatformCommon::Private::ScreenHeight;
|
||||
|
||||
#ifndef WIN32
|
||||
if(fileExists("megaglest.bmp")) {
|
||||
string mg_icon_file = "";
|
||||
#if defined(CUSTOM_DATA_INSTALL_PATH_VALUE)
|
||||
if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp")) {
|
||||
mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp";
|
||||
}
|
||||
#endif
|
||||
|
||||
if(mg_icon_file == "" && fileExists("megaglest.bmp")) {
|
||||
mg_icon_file = "megaglest.bmp";
|
||||
}
|
||||
if(mg_icon_file != "") {
|
||||
|
||||
if(icon != NULL) {
|
||||
SDL_FreeSurface(icon);
|
||||
icon = NULL;
|
||||
}
|
||||
|
||||
icon = SDL_LoadBMP("megaglest.bmp");
|
||||
icon = SDL_LoadBMP(mg_icon_file.c_str());
|
||||
//SDL_Surface *icon = IMG_Load("megaglest.ico");
|
||||
|
||||
|
||||
|
|
|
@ -141,6 +141,14 @@ bool Properties::applyTagsToValue(string &value) {
|
|||
replaceAll(value, "$APPLICATIONPATH", Properties::applicationPath);
|
||||
replaceAll(value, "%%APPLICATIONPATH%%", Properties::applicationPath);
|
||||
|
||||
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
||||
replaceAll(value, "$APPLICATIONDATAPATH", CUSTOM_DATA_INSTALL_PATH);
|
||||
replaceAll(value, "%%APPLICATIONDATAPATH%%", CUSTOM_DATA_INSTALL_PATH);
|
||||
#else
|
||||
replaceAll(value, "$APPLICATIONDATAPATH", Properties::applicationPath);
|
||||
replaceAll(value, "%%APPLICATIONDATAPATH%%", Properties::applicationPath);
|
||||
#endif
|
||||
|
||||
return (originalValue != value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue