Commit be9d01e9 authored by Victor Yacovlev's avatar Victor Yacovlev

Fixed file open permissions while reading external modules

parent f760044d
......@@ -315,9 +315,19 @@ void KumirVM::setProgram(const Bytecode::Data &program, bool isMain, const Strin
modulePath += e.fileName;
}
const std::string filename = Kumir::Coder::encode(VM_LOCALE, modulePath);
std::fstream externalfile(filename.c_str());
if (!Kumir::Files::exist(modulePath) || !externalfile.is_open()) {
Kumir::String errorMessage = Kumir::Core::fromUtf8("Не могу загрузить внешний исполнитель: ")+modulePath;
std::ifstream externalfile(filename.c_str());
if (
!Kumir::Files::exist(modulePath)
|| !externalfile.is_open()
)
{
int error = errno;
Kumir::String errorMessage = Kumir::Core::fromUtf8("Не могу загрузить внешний исполнитель: ")
+modulePath
+Kumir::Core::fromUtf8(" (ошибка ")
+Kumir::Converter::sprintfInt(error,10,0,0)
+Kumir::Core::fromAscii(") ")
;
throw errorMessage;
}
Bytecode::Data programData;
......
......@@ -224,6 +224,7 @@ bool InteractionHandler::makeInputArgument(VM::Variable &reference)
int main(int argc, char *argv[])
{
// sleep(15); // for remote debugger
// Look at arguments
std::string programName;
std::deque<std::string> args;
......
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