Commit 24cd036f authored by Victor Yacovlev's avatar Victor Yacovlev

Fixed kumir modules search if file name contains spaces (Linux

implementation)
TODO: Check for MacOS
parent d8baeaf7
......@@ -305,8 +305,9 @@ void SyntaxAnalizer::buildTables(bool isInternalBuild)
}
QFileInfo kodFile(name);
QString kodFilePath = QDir::toNativeSeparators(kodFile.absoluteFilePath());
const char * programName = kodFilePath.toLocal8Bit().constData();
std::ifstream programFile(programName);
char programName[1024];
strcpy(programName, kodFilePath.toLocal8Bit().constData());
std::ifstream programFile(programName, std::ios::in|std::ios::binary);
Bytecode::Data programData;
if (!programFile.is_open()) {
error = _("Can't open module file");
......@@ -342,6 +343,8 @@ void SyntaxAnalizer::buildTables(bool isInternalBuild)
if (algSig.size()>1) {
QStringList argSignatures = algSig[1].split(",");
for (int argNo=0; argNo<argSignatures.size(); argNo++) {
if (argSignatures[argNo].length()==0)
break;
AST::Variable * var = new AST::Variable;
QStringList sigPair = argSignatures[argNo].split(" ");
if (sigPair[0]=="in")
......
......@@ -1294,10 +1294,8 @@ public:
# ifdef NO_UNICODE
workDir = String(cwd);
# else
wchar_t wcwd[1024];
size_t pl = mbstowcs(wcwd, cwd, 1024);
wcwd[pl] = L'\0';
workDir = String(wcwd);
std::string sworkDir = std::string(cwd);
workDir = Core::fromUtf8(sworkDir);
# endif
workDir.push_back(Char('/'));
String absPath;
......@@ -1315,10 +1313,8 @@ public:
# ifdef NO_UNICODE
workDir = String(cwd);
# else
wchar_t wcwd[1024];
size_t pl = mbstowcs(wcwd, cwd, 1024);
wcwd[pl] = L'\0';
workDir = String(wcwd);
std::string sworkDir = std::string(cwd);
workDir = Core::fromUtf8(sworkDir);
# endif
return workDir;
}
......
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