From 71577b7b0a4f57a34bf31a15fb52d32e926026e2 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 31 Oct 2014 20:19:33 +0100 Subject: Fixed #335 and #348 --- src/object/robotmain.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index afdca9e..ad78e39 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -5390,9 +5390,9 @@ void CRobotMain::CompileScript(bool soluce) if (brain->GetCompile(j)) continue; std::string name = brain->GetScriptName(j); - name = "ai/"+name; if (name[0] != 0) { + name = "ai/"+name; if(! brain->ReadProgram(j, const_cast(name.c_str()))) { CLogger::GetInstancePointer()->Error("Unable to read script from file \"%s\"\n", name.c_str()); } @@ -5486,6 +5486,7 @@ void CRobotMain::LoadFileScript(CObject *obj, const char* filename, int objRank, std::string fnstr = filename; + boost::replace_all(fnstr, "\\", "/"); boost::replace_all(fnstr, m_dialog->GetSavegameDir(), m_dialog->GetPHYSFSSavegameDir()); //TODO: Refactor to get physfs path here //TODO: Refactor to std::string char fn[MAX_FNAME]; @@ -5557,6 +5558,7 @@ void CRobotMain::SaveFileScript(CObject *obj, const char* filename, int objRank) if (type == OBJECT_HUMAN) return; std::string fnstr = filename; + boost::replace_all(fnstr, "\\", "/"); boost::replace_all(fnstr, m_dialog->GetSavegameDir(), m_dialog->GetPHYSFSSavegameDir()); //TODO: Refactor to get physfs path here //TODO: Refactor to std::string char fn[MAX_FNAME]; -- cgit v1.2.3-1-g7c22