* "BuildMenu" preference: store filename (def. build_menu.xml) instead of absolute path for portability; absolute path is supported too, if set
* fix: load customized build_menu.xml from settings folder on the very first start and with senseless "BuildMenu" value
This commit is contained in:
parent
5e50ac9ccf
commit
168e085d8e
|
|
@ -996,12 +996,6 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
CopiedString g_buildMenu;
|
|
||||||
CopiedString g_lastExecutedBuild;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadBuildMenu();
|
void LoadBuildMenu();
|
||||||
|
|
||||||
void DoBuildMenu(){
|
void DoBuildMenu(){
|
||||||
|
|
@ -1038,9 +1032,10 @@ void DoBuildMenu(){
|
||||||
#include "gtkutil/menu.h"
|
#include "gtkutil/menu.h"
|
||||||
#include "mainframe.h"
|
#include "mainframe.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
|
||||||
typedef struct _GtkMenuItem GtkMenuItem;
|
typedef struct _GtkMenuItem GtkMenuItem;
|
||||||
|
|
||||||
|
CopiedString g_lastExecutedBuild;
|
||||||
|
|
||||||
class BuildMenuItem
|
class BuildMenuItem
|
||||||
{
|
{
|
||||||
const char* m_name;
|
const char* m_name;
|
||||||
|
|
@ -1089,8 +1084,30 @@ void Build_refreshMenu( GtkMenu* menu ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
#include "os/path.h"
|
||||||
|
|
||||||
|
CopiedString g_buildMenu;
|
||||||
|
|
||||||
|
const char* g_buildMenuFullPah(){
|
||||||
|
if( path_is_absolute( g_buildMenu.c_str() ) )
|
||||||
|
return g_buildMenu.c_str();
|
||||||
|
|
||||||
|
static StringOutputStream buffer( 256 );
|
||||||
|
buffer.clear();
|
||||||
|
buffer << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << "/" << g_buildMenu.c_str();
|
||||||
|
return buffer.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LoadBuildMenu(){
|
void LoadBuildMenu(){
|
||||||
if ( string_empty( g_buildMenu.c_str() ) || !build_commands_parse( g_buildMenu.c_str() ) ) {
|
if ( g_buildMenu.empty() || !build_commands_parse( g_buildMenuFullPah() ) ) {
|
||||||
|
if( !string_equal_nocase( g_buildMenu.c_str(), "build_menu.xml" ) ){
|
||||||
|
g_buildMenu = "build_menu.xml";
|
||||||
|
if( build_commands_parse( g_buildMenuFullPah() ) )
|
||||||
|
return;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
StringOutputStream buffer( 256 );
|
StringOutputStream buffer( 256 );
|
||||||
buffer << GameToolsPath_get() << "default_build_menu.xml";
|
buffer << GameToolsPath_get() << "default_build_menu.xml";
|
||||||
|
|
@ -1098,19 +1115,13 @@ void LoadBuildMenu(){
|
||||||
bool success = build_commands_parse( buffer.c_str() );
|
bool success = build_commands_parse( buffer.c_str() );
|
||||||
ASSERT_MESSAGE( success, "failed to parse default build commands: " << buffer.c_str() );
|
ASSERT_MESSAGE( success, "failed to parse default build commands: " << buffer.c_str() );
|
||||||
}
|
}
|
||||||
{
|
|
||||||
StringOutputStream buffer( 256 );
|
|
||||||
buffer << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << "/build_menu.xml";
|
|
||||||
|
|
||||||
g_buildMenu = buffer.c_str();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveBuildMenu(){
|
void SaveBuildMenu(){
|
||||||
if ( g_build_changed ) {
|
if ( g_build_changed ) {
|
||||||
g_build_changed = false;
|
g_build_changed = false;
|
||||||
build_commands_write( g_buildMenu.c_str() );
|
build_commands_write( g_buildMenuFullPah() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user