Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error messages on file writing #3309

Closed
Yrds opened this issue Mar 23, 2022 · 2 comments
Closed

Better error messages on file writing #3309

Yrds opened this issue Mar 23, 2022 · 2 comments
Labels
feature It's a feature, not a bug.

Comments

@Yrds
Copy link

Yrds commented Mar 23, 2022

First of all I'd like to thank you for this piece of software. It's very useful for making tilemaps

Is your feature request related to a problem? Please describe.

First time using Tiled, I downloaded a project from an art designer that have layers named like "objects/doors" "objects/roofs". I tried to export these maps to .csv, and it's shows up a message "Can't open file for writing".

Digging out on Google I couldn't find a solution, and after some hours I finally understand why I can't save those layers, that's because the layers are named with slashes and probably a directory must exists to export theses layers.

Describe the solution you'd like

Error messages can be detailed like can't open file for writing: ${full_file_path}. That way it's easier to figure out more quickly on how to solve this problem.

Describe alternatives you've considered

I don't think blocking slashes from layer's name It's a good solution, tough can break existing projects layout and some people can use this feature as advantage for project organization.

@Yrds Yrds added the feature It's a feature, not a bug. label Mar 23, 2022
@bjorn
Copy link
Member

bjorn commented Mar 24, 2022

Right, mentioning the file name in the error message is a good idea. Besides that, I guess we could automatically turn "/" into "_" in the CSV plugin when setting up the file names.

bjorn added a commit that referenced this issue Mar 24, 2022
When a file can't be opened for writing, the error message now includes
the name of the file.

Also, characters that are reserved for file names on Windows[1] are now
automatically replaced.

[1]: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

Closes #3309
@bjorn
Copy link
Member

bjorn commented Mar 24, 2022

I've added the file name to the error message. But also, you'll no longer see this error because the reserved characters are now automatically replaced by _. :-)

@bjorn bjorn closed this as completed in 041583c Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

2 participants