Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 918510 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/slic3r/GUI/ScriptExecutor.cpp (-2 / +13 lines)
Lines 10-18 Link Here
10
#include <boost/algorithm/string/erase.hpp>
10
#include <boost/algorithm/string/erase.hpp>
11
#include <boost/algorithm/string/split.hpp>
11
#include <boost/algorithm/string/split.hpp>
12
#include <boost/filesystem.hpp>
12
#include <boost/filesystem.hpp>
13
#include <boost/filesystem/string_file.hpp>
14
13
15
#include <string>
14
#include <string>
15
#include <fstream> 
16
#include <angelscript/source/as_config.h>
16
#include <angelscript/source/as_config.h>
17
#include <angelscript/add_on/autowrapper/aswrappedcall.h>
17
#include <angelscript/add_on/autowrapper/aswrappedcall.h>
Lines 616-621 bool as_is_enabled(std::string &key) Link Here
616
    return f->is_enabled();
619
    return f->is_enabled();
617
}
620
}
618
621
622
inline
623
void load_string_file(const boost::filesystem::path& p, std::string& str)
624
{
625
       std::ifstream file;
626
       file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
627
       file.open(p, std::ios_base::binary);
628
       std::size_t sz = static_cast<std::size_t>(boost::filesystem::file_size(p));
629
       str.resize(sz, '\0');
630
       file.read(&str[0], sz);
631
}
632
619
//function to reset a field
633
//function to reset a field
620
void as_back_initial_value(std::string& key) {
634
void as_back_initial_value(std::string& key) {
621
    current_script->add_to_reset(key);
635
    current_script->add_to_reset(key);
Lines 745-751 void ScriptContainer::init(const std::string& tab_key, Tab* tab) Link Here
745
        //res = builder.AddSectionFromFile(ui_script_file.string().c_str()); //seems to be problematic on cyrillic locale
759
        //res = builder.AddSectionFromFile(ui_script_file.string().c_str()); //seems to be problematic on cyrillic locale
746
        {
760
        {
747
            std::string all_file;
761
            std::string all_file;
748
            boost::filesystem::load_string_file(ui_script_file, all_file);
762
            load_string_file(ui_script_file, all_file);
749
            res = builder.AddSectionFromMemory(ui_script_file.string().c_str(), all_file.c_str(), (unsigned int)(all_file.length()), 0);
763
            res = builder.AddSectionFromMemory(ui_script_file.string().c_str(), all_file.c_str(), (unsigned int)(all_file.length()), 0);
750
        }
764
        }
751
        if (res < 0) throw CompileErrorException("Error, can't build the script for tab " + tab_key);
765
        if (res < 0) throw CompileErrorException("Error, can't build the script for tab " + tab_key);

Return to bug 918510