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