Skip to content

Commit

Permalink
Allow the compilation in non-ASCII paths (#6235)
Browse files Browse the repository at this point in the history
* Allow the compilation in non-ASCII paths

* Update changelog-r2023.md

* The name of the controller should be in local 8 bit, not UTF-8

* Removed debug statement
  • Loading branch information
omichel authored Jun 21, 2023
1 parent 99094bf commit 7971363
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/reference/changelog-r2023.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Released on ??
- Added `proto_formatter.py` script to automatically indent PROTO files ([#6167](https://github.com/cyberbotics/webots/pull/6167)).
- Disabled the computation of shadow reception on meshes when shadows are globally disabled([#6201](https://github.com/cyberbotics/webots/pull/6201)).
- Bug Fixes
- Windows: fixed compilation of controller programs located in paths with non-ASCII characters ([#6235](https://github.com/cyberbotics/webots/pull/6235)).
- Fixed the size of the Kondo [KHR-3HV](https://webots.cloud/run?url={{ url.github_tree }}/projects/robots/kondo/khr-3hv/protos/Khr3hv.proto) robot which was twice too large ([#6228](https://github.com/cyberbotics/webots/pull/6228)).
- Fixed random crashes while creating [Skin](skin.md) and Mesh(mesh.md) nodes ([#6218](https://github.com/cyberbotics/webots/pull/6218)).
- Fixed the MATLAB `wb_camera_recognition_get_objects` API function ([#6172](https://github.com/cyberbotics/webots/pull/6172)).
Expand Down
16 changes: 9 additions & 7 deletions src/webots/editor/WbBuildEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,14 @@ void WbBuildEditor::make(const QString &target) {

// find out compilation directory
QString compilePath = compileDir().absolutePath();
// On Windows, make won't work if the Makefile file is located in a path with UTF-8 characters (e.g., Chinese)

// On Windows, gcc won't work if the source file contains UTF-8 characters (e.g., Chinese)
#ifdef _WIN32
if (!isJavaProgram && QString(compilePath.toUtf8()) != QString::fromLocal8Bit(compilePath.toLocal8Bit())) {
WbMessageBox::warning(tr("\'%1\'\n\nThe path to this Webots project contains non 8-bit characters. "
"Webots won't be able to compile any C/C++ controller in this path. "
"Please move this Webots project into a folder with only 8-bit characters.")
const QString controllerName = QFileInfo(compilePath).baseName();
if (!isJavaProgram && QString(controllerName.toUtf8()) != QString::fromLocal8Bit(controllerName.toLocal8Bit())) {
WbMessageBox::warning(tr("\'%1\'\n\nThe robot controller name contains non 8-bit characters. "
"Webots won't be able to compile any C/C++ controller with such a name. "
"Please rename this robot controller with only 8-bit characters.")
.arg(compilePath),
this);
return;
Expand Down Expand Up @@ -425,8 +427,8 @@ void WbBuildEditor::make(const QString &target) {

QStringList WbBuildEditor::getJavaCommandLine(const QString &target) const {
QDir controllerDir = compileDir();
QString controllerPath = controllerDir.absolutePath();
QString controllerName = QFileInfo(controllerPath).baseName();
const QString controllerPath = controllerDir.absolutePath();
const QString controllerName = QFileInfo(controllerPath).baseName();
QStringList commandLine;

if (target == "clean")
Expand Down

0 comments on commit 7971363

Please sign in to comment.