Commit ded8718c authored by Murray Cumming's avatar Murray Cumming

Script::add_search_paths(): Use std::string for filepaths.

* clutter/src/script.[hg|ccg]:
  Also avoid this g++ compiler warning:
  ISO C++ forbids variable length array 'searchPaths' [-Werror=vla]

  This shows the need for this patch in cogl to avoid a warning:
parent f09424e5
......@@ -16,6 +16,7 @@
#include <clutter/clutter.h>
#include <glibmm/vectorutils.h>
namespace Clutter
......@@ -39,17 +40,10 @@ guint Script::load_from_data(const Glib::ustring& data, std::auto_ptr<Glib::Erro
return result;
void Script::add_search_paths(const std::vector<Glib::ustring>& paths)
void Script::add_search_paths(const std::vector<std::string>& paths)
const int pathCount = paths.size();
const char* searchPaths[pathCount];
for(uint i = 0; i < paths.size(); ++i)
searchPaths[i] = paths[i].data();
clutter_script_add_search_paths(gobj(), searchPaths, paths.size());
Glib::ArrayHandler<std::string>::vector_to_array(paths).data(), paths.size());
std::vector<Glib::RefPtr<Glib::Object> > Script::list_objects()
......@@ -46,8 +46,16 @@ public:
_WRAP_METHOD(guint load_from_file(const std::string& filename), clutter_script_load_from_file, errthrow)
/** Adds paths to the list of search paths held by the Script .
* The search paths are used by lookup_filename(), which can be used to define
* search paths for the textures source file name or other custom, file-based
* properties.
* @param Search paths.
void add_search_paths(const std::vector<std::string>& paths);
void add_search_paths(const std::vector<Glib::ustring>& paths);
_WRAP_METHOD(Glib::ustring lookup_filename(const Glib::ustring& filename), clutter_script_lookup_filename)
/** Get a RefPtr to an object from the ClutterScript JSON file.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment