diff --git a/doc/function/get_mse_path.txt b/doc/function/get_mse_path.txt new file mode 100644 index 00000000..5e34f339 --- /dev/null +++ b/doc/function/get_mse_path.txt @@ -0,0 +1,6 @@ +Function: get_mse_path + +--Usage-- +> get_mse_path() + +Returns the current MSE app folder absolute path. diff --git a/doc/function/index.txt b/doc/function/index.txt index b1549d2d..875b83c4 100644 --- a/doc/function/index.txt +++ b/doc/function/index.txt @@ -113,6 +113,7 @@ These functions are built into the program, other [[type:function]]s can be defi ! Other functions <<< | [[fun:get_mse_version]] Get the MSE app version. +| [[fun:get_mse_path]] Get the MSE app folder absolute path. | [[fun:trace]] Output a message for debugging purposes. | [[fun:assert]] Check a condition for debugging purposes. | [[fun:warning]] Output a warning message. diff --git a/src/script/functions/basic.cpp b/src/script/functions/basic.cpp index 7f6b462e..016dfb13 100644 --- a/src/script/functions/basic.cpp +++ b/src/script/functions/basic.cpp @@ -19,11 +19,21 @@ #include #include #include +#include +#include + // ----------------------------------------------------------------------------- : Debugging SCRIPT_FUNCTION(get_mse_version) { SCRIPT_RETURN(app_version.toString()); +} + +SCRIPT_FUNCTION(get_mse_path) { + wxFileName app_path(wxStandardPaths::Get().GetExecutablePath()); + String app_folder = app_path.GetPath(); + app_folder.Replace("\\", "/"); + SCRIPT_RETURN(app_folder); } SCRIPT_FUNCTION(trace) { @@ -770,6 +780,7 @@ SCRIPT_FUNCTION(rule) { void init_script_basic_functions(Context& ctx) { // debugging ctx.setVariable(_("get_mse_version"), script_get_mse_version); + ctx.setVariable(_("get_mse_path"), script_get_mse_path); ctx.setVariable(_("trace"), script_trace); ctx.setVariable(_("warning"), script_warning); ctx.setVariable(_("error"), script_error); diff --git a/tools/website/drupal/mse-drupal-modules/highlight.inc b/tools/website/drupal/mse-drupal-modules/highlight.inc index a481a99d..d5e3772e 100644 --- a/tools/website/drupal/mse-drupal-modules/highlight.inc +++ b/tools/website/drupal/mse-drupal-modules/highlight.inc @@ -104,6 +104,7 @@ $built_in_functions = array( 'write_set_file' =>'', // other 'get_mse_version' =>'', + 'get_mse_path' =>'', 'trace' =>'', 'assert' =>'', 'exists_in_package' =>'',