Subversion Repositories HomeAutomation

Rev

Rev 1647 | Rev 1657 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1647 Rev 1656
Line 70... Line 70...
70
void Manager::AddPlugin(Plugin::Pointer plugin)
70
void Manager::AddPlugin(Plugin::Pointer plugin)
71
{
71
{
72
    this->plugins_.push_back(plugin);
72
    this->plugins_.push_back(plugin);
73
}
73
}
74
 
74
 
75
void Manager::Start(std::string script_path)
75
void Manager::Start(std::string script_path, std::string user_script_path)
76
{
76
{
77
    this->script_path_ = script_path;
77
    this->script_path_ = script_path;
-
 
78
    this->user_script_path_ = user_script_path;
78
    this->io_service_.post(boost::bind(&Manager::StartHandler, this));
79
    this->io_service_.post(boost::bind(&Manager::StartHandler, this));
79
}
80
}
80
 
81
 
81
void Manager::CallOutput(std::string output)
82
void Manager::CallOutput(std::string output)
82
{
83
{
Line 230... Line 231...
230
            LOG.Info(scriptname + " is already loaded.");
231
            LOG.Info(scriptname + " is already loaded.");
231
            return true;
232
            return true;
232
        }
233
        }
233
    }
234
    }
234
   
235
   
235
    std::string path = this->script_path_ + scriptname;
236
    std::string path = this->user_script_path_ + scriptname;
236
    std::ifstream file(path.data());
237
    std::ifstream file(path.data());
-
 
238
   
-
 
239
    if (!file.is_open())
-
 
240
    {
-
 
241
        path = this->script_path_ + scriptname;
-
 
242
        file.open(path.data());
237
   
243
       
238
    if (!file.is_open())
244
        if (!file.is_open())
239
    {
245
        {
240
        file.close();
246
            file.close();
241
        LOG.Warning("Could not load " + scriptname + ".");
247
            LOG.Warning("Could not load " + scriptname + ".");
242
        return false;
248
            return false;
-
 
249
        }
243
    }
250
    }
244
   
251
   
245
    std::string code = "";
252
    std::string code = "";
246
    std::string line;
253
    std::string line;
247
   
254