Skip to content

Commit

Permalink
Merge pull request #3087 from mgreter/bugfix/readd-plugin-api-getters
Browse files Browse the repository at this point in the history
Add back C-API getters for plugin paths
  • Loading branch information
mgreter authored May 1, 2020
2 parents f1df4dc + 7c8a545 commit f63b00d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/sass/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ ADDAPI char** ADDCALL sass_context_get_included_files (struct Sass_Context* ctx)
// Getters for options include path array
ADDAPI size_t ADDCALL sass_option_get_include_path_size(struct Sass_Options* options);
ADDAPI const char* ADDCALL sass_option_get_include_path(struct Sass_Options* options, size_t i);
// Plugin paths to load dynamic libraries work the same
ADDAPI size_t ADDCALL sass_option_get_plugin_path_size(struct Sass_Options* options);
ADDAPI const char* ADDCALL sass_option_get_plugin_path(struct Sass_Options* options, size_t i);

// Calculate the size of the stored null terminated array
ADDAPI size_t ADDCALL sass_context_get_included_files_size (struct Sass_Context* ctx);
Expand Down
17 changes: 17 additions & 0 deletions src/sass_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,23 @@ extern "C" {
return cur->string;
}

// Push function for plugin paths (no manipulation support for now)
size_t ADDCALL sass_option_get_plugin_path_size(struct Sass_Options* options)
{
size_t len = 0;
struct string_list* cur = options->plugin_paths;
while (cur) { len++; cur = cur->next; }
return len;
}

// Push function for plugin paths (no manipulation support for now)
const char* ADDCALL sass_option_get_plugin_path(struct Sass_Options* options, size_t i)
{
struct string_list* cur = options->plugin_paths;
while (i) { i--; cur = cur->next; }
return cur->string;
}

// Push function for plugin paths (no manipulation support for now)
void ADDCALL sass_option_push_plugin_path(struct Sass_Options* options, const char* path)
{
Expand Down

0 comments on commit f63b00d

Please sign in to comment.