Godot version:
3.2.1.stable
OS/device including version:
Windows
Issue description:
is_valid_filename() returns true for Windows reserved filenames
Steps to reproduce:
print("Con".is_valid_filename())
Minimal reproduction project:
Thank you so much :)
The question is, should we make it return false
on other platforms where Con
or NUL
are valid filenames? Or should we err on the side of caution and return false
on all platforms?
Maybe a parameter inside the is_valid_filename(IsValid for all platforms) ?
I'm not sure either
@LoneDespair I don't know, there needs to be a valid usecase to support both kinds of checks.
Related to #20110.
As much as it sucks that Windows has such outdated filename restrictions, I guess we should extend them to all platforms to ensure cross-platform compatibility.
preloading a string that contains the reserved filenames causes the editor to hang indefinitely
Tests:
var Test = preload("Con")
var Test = preload("res://Con")
I'm really sorry but I'm not sure if i should open a new issue on cases like this
Well that's the issue I referenced above, so no, no need to reopen a new one.
@akien-mga thank you
Naming the root node as Con and saving it also hangs the editor indefinitely
For your information, I have written information on file name support in applications. The page refers to a "MakeFilename" method I wrote for C# and Java; however, as you can see by its implementation, avoiding problematic file names is anything but trivial.
For Windows in particular, see "Naming Files, Paths, and Namespaces" on docs.microsoft.com.
As said by peteroupc, windows doesn't allow:
.
.I was planning on making a PR with these in mind but I was wondering if and where I should store this list. Should I just,
ustring
or
Most helpful comment
Related to #20110.
As much as it sucks that Windows has such outdated filename restrictions, I guess we should extend them to all platforms to ensure cross-platform compatibility.