Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Support filenames containing spaces #2870

Closed
12 tasks done
chapulina opened this issue Nov 6, 2020 · 5 comments
Closed
12 tasks done

Support filenames containing spaces #2870

chapulina opened this issue Nov 6, 2020 · 5 comments
Assignees
Labels
9 Gazebo 9 11 Gazebo 11 enhancement New feature or request

Comments

@chapulina
Copy link
Contributor

chapulina commented Nov 6, 2020

File names and paths containing spaces have never been officially supported by Gazebo classic. There are use cases which are known to work, but because this has never been a well supported use case, there are corner cases that won't work, and there's also the possibility that new functionality breaks existing cases that happen to work.

This issue is about making the support for spaces in file names and paths official. Test cases will be added for all supported file types and ways of inserting them into simulation, to make sure they continue to be supported. In the process, the use cases which don't currently work will be fixed.

The following file types will support spaces:

Notably, plugin files (shared libraries) are not included in this list.

@chapulina chapulina added enhancement New feature or request 9 Gazebo 9 11 Gazebo 11 labels Nov 6, 2020
@chapulina chapulina self-assigned this Nov 6, 2020
@chapulina
Copy link
Contributor Author

According to Ogre's documentation, textures in material scripts can't have spaces. As they gracefully put it:

"Note that the texture file cannot include spaces. Those of you Windows users who like spaces in filenames, please get over it and use underscores instead."

However, in my testing, I saw that spaces work not only on texture files, but also the material files themselves. At least on Linux. I added a test here: bd91bfd. If it fails on Windows, I'll disable the test there.

@chapulina
Copy link
Contributor Author

I couldn't find an official OBJ specification. Looking around the internet, it seems that there isn't a consensus about whether spaces should be supported in files referenced from OBJ and MTL files, more specifically:

  • MTL files referenced from OBJ files
  • Texture files referenced from MTL files

Gazebo uses tinyobjloader, and that project made a conscious decision of not supporting files with spaces (tinyobjloader/tinyobjloader#46), because there are use cases where multiple files may be specified, and they're separated by spaces.

On the other hand, it looks like Meshlab supports spaces in these filenames through the VCGlib parser, see issue cnr-isti-vclab/meshlab#66, which I believe was fixed by this commit: cnr-isti-vclab/vcglib@c547c56.

Since Gazebo uses tinyobjloader and they have a good reason for not supporting spaces, I think Gazebo shouldn't support spaces in resources used by these files.

@chapulina
Copy link
Contributor Author

OBJ / MTL

It turned out that textures referenced in MTL files were already working, so the only missing piece was referencing MTL files from OBJ.

I opened a PR against tinyobjloader to add support for escaping spaces in MTL files: tinyobjloader/tinyobjloader#285.. If that gets in and is released, I'll open a separate PR updating our internal fork of tinyobjloader to their latest 1.x tag.

@chapulina
Copy link
Contributor Author

The last piece of the puzzle (MTL / OBJ) is on #2885.

@chapulina
Copy link
Contributor Author

Solved by #2877 and #2885

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
9 Gazebo 9 11 Gazebo 11 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant