diff --git a/source/glest_game/CMakeLists.txt b/source/glest_game/CMakeLists.txt index d817b34a..d87a4f62 100644 --- a/source/glest_game/CMakeLists.txt +++ b/source/glest_game/CMakeLists.txt @@ -190,3 +190,47 @@ 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) + +# 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 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) + diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index dce0617b..72d1ce43 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -2724,7 +2724,7 @@ int glestMainWrapper(int argc, char** argv) { #ifdef WIN32_STACK_TRACE __try { #endif - application_binary= executable_path(argv[0]); + 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) diff --git a/source/glest_game/types/faction_type.cpp b/source/glest_game/types/faction_type.cpp index 2215c54d..4af3c734 100644 --- a/source/glest_game/types/faction_type.cpp +++ b/source/glest_game/types/faction_type.cpp @@ -195,9 +195,6 @@ std::vector FactionType::validateFactionType() { } } - //const SoundContainer & getCommandSounds() const { return commandSounds; } - - for(int j = 0; j < unitType.getCommandTypeCount(); ++j) { const CommandType *cmdType = unitType.getCommandType(j); if(cmdType != NULL) { diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 8a14b808..779797ca 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -701,7 +701,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { builtUnit->create(); if(builtUnitType->hasSkillClass(scBeBuilt) == false) { - throw runtime_error("Unit [" + builtUnitType->getName() + "] has no be_built skill."); + throw runtime_error("Unit [" + builtUnitType->getName() + "] has no be_built skill, producer was [" + intToStr(unit->getId()) + " - " + unit->getType()->getName() + "]."); } builtUnit->setCurrSkill(scBeBuilt); diff --git a/source/shared_lib/include/platform/common/platform_common.h b/source/shared_lib/include/platform/common/platform_common.h index c8d0f819..cab52c5a 100644 --- a/source/shared_lib/include/platform/common/platform_common.h +++ b/source/shared_lib/include/platform/common/platform_common.h @@ -209,7 +209,7 @@ inline string trim (const string & s, const string & t = SPACES) { string getFullFileArchiveExtractCommand(string fileArchiveExtractCommand, string fileArchiveExtractCommandParameters, string outputpath, string archivename); bool executeShellCommand(string cmd,int expectedResult=IGNORE_CMD_RESULT_VALUE); -string executable_path(string exeName); +string executable_path(string exeName,bool includeExeNameInPath=false); class ValueCheckerVault { diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 3059b149..09d02898 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -1678,24 +1678,44 @@ off_t getFileSize(string filename) { return 0; } -string executable_path(string exeName) { +string executable_path(string exeName, bool includeExeNameInPath) { string value = ""; #ifdef _WIN32 char path[MAX_PATH]=""; if( GetModuleFileName(NULL,path,MAX_PATH) == 0 ) { - value = extractDirectoryPathFromFile(exeName); + if(includeExeNameInPath == true) { + value = exeName; + } + else { + value = extractDirectoryPathFromFile(exeName); + } } else { - value = extractDirectoryPathFromFile(path); + if(includeExeNameInPath == true) { + value = path; + } + else { + value = extractDirectoryPathFromFile(path); + } } #elif __APPLE__ char path[MAXPATHLEN+1]=""; uint32_t path_len = MAXPATHLEN; if ( _NSGetExecutablePath(path, &path_len) ) { - value = extractDirectoryPathFromFile(exeName); + if(includeExeNameInPath == true) { + value = exeName; + } + else { + value = extractDirectoryPathFromFile(exeName); + } } else { - value = extractDirectoryPathFromFile(path); + if(includeExeNameInPath == true) { + value = path; + } + else { + value = extractDirectoryPathFromFile(path); + } } #else char exe_link_path[200]=""; @@ -1703,23 +1723,43 @@ string executable_path(string exeName) { if(length < 0 || length >= 200 ) { char *argv0_path = realpath(exeName.c_str(),NULL); if(argv0_path != NULL) { - value = extractDirectoryPathFromFile(argv0_path); + if(includeExeNameInPath == true) { + value = argv0_path; + } + else { + value = extractDirectoryPathFromFile(argv0_path); + } free(argv0_path); argv0_path = NULL; } else { const char *shell_path = getenv("_"); if(shell_path != NULL) { - value = extractDirectoryPathFromFile(shell_path); + if(includeExeNameInPath == true) { + value = shell_path; + } + else { + value = extractDirectoryPathFromFile(shell_path); + } } else { - value = extractDirectoryPathFromFile(exeName); + if(includeExeNameInPath == true) { + value = exeName; + } + else { + value = extractDirectoryPathFromFile(exeName); + } } } } else { exe_link_path[length] = '\0'; - value = extractDirectoryPathFromFile(exe_link_path); + if(includeExeNameInPath == true) { + value = exe_link_path; + } + else { + value = extractDirectoryPathFromFile(exe_link_path); + } } #endif return value;