mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Merge pull request #42 from G-e-n-e-v-e-n-s-i-S/get-mse-path
add get_mse_path script function
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
Function: get_mse_path
|
||||
|
||||
--Usage--
|
||||
> get_mse_path()
|
||||
|
||||
Returns the current MSE app folder absolute path.
|
||||
@@ -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.
|
||||
|
||||
@@ -19,11 +19,21 @@
|
||||
#include <data/card.hpp>
|
||||
#include <data/game.hpp>
|
||||
#include <random>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : 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);
|
||||
|
||||
@@ -104,6 +104,7 @@ $built_in_functions = array(
|
||||
'write_set_file' =>'',
|
||||
// other
|
||||
'get_mse_version' =>'',
|
||||
'get_mse_path' =>'',
|
||||
'trace' =>'',
|
||||
'assert' =>'',
|
||||
'exists_in_package' =>'',
|
||||
|
||||
Reference in New Issue
Block a user