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

macOS filesystems can be case insensitive, editor should also warn like Windows on case mismatch #23441

Open
thorlucas opened this issue Nov 1, 2018 · 7 comments · May be fixed by #24860
Open

Comments

@thorlucas
Copy link

thorlucas commented Nov 1, 2018

I found an irritating bug that took a long time to track down. I was able to make a minimal reproducible project. The project would work when launching in Godot but crash immediately when launching on the exported Mac app.

Suppose we have a script like this:

# res://base/Bar.gd

extends Node

and another file

# res://Foo.gd

extends 'res://Base/Bar.gd'

Notice the capitalization mistake? Neither did I. Godot, I guess, will ignore capitalization in directories. The project runs just fine. It throws no errors. But when exporting to Mac, it will not launch. Caused me a lot of frustration.

Suggestions for a fix: make Godot case-sensitive with directories. Or at least throw a warning when capitalization does not match.

Edit: these tests were done on macOS.

@akien-mga
Copy link
Member

It's not Godot ignoring case, it's Windows (which is why our issue template asks you for your OS... please don't make us guess it).

Or at least throw a warning when capitalization does not match.

It should already do that normally.

@thorlucas
Copy link
Author

My bad @akien-mga. I’m on macOS. Which is why it’s so bizarre that this works when running within Godot but crashes the exported app.

I got no sort of warning in the Godot debugger about capitalization. It works flawlessly.

@akien-mga
Copy link
Member

Yeah the warning was only implemented for Windows, as macOS is supposed to be case sensitive. Is your macOS partition configured to be case insensitive?

@thorlucas
Copy link
Author

@akien-mga So bizarre! Been using macOS for many years and have never noticed that the default configuration for APFS is case-insensitive. What I don't understand is why this would then not work on the exported app.

Considering that this is the case, I think the warning should also be implemented on macOS to avoid this sort of confusion.

Thanks!

@akien-mga akien-mga changed the title Capitalization causes project to run in Godot but fail when exporting to Mac macOS filesystems can be case insensitive, editor should also warn like Windows on case mismatch Nov 2, 2018
@thorlucas
Copy link
Author

"APFS [...] is available in case-sensitive and case-insensitive variants on macOS, with case-insensitive being the default." According to Apple's developer website

@akien-mga
Copy link
Member

Indeed, something similar to this should be implemented in drivers/unix/file_access_unix.cpp (but only for #ifdef OSX_ENABLED):

#ifdef TOOLS_ENABLED
// Windows is case insensitive, but all other platforms are sensitive to it
// To ease cross-platform development, we issue a warning if users try to access
// a file using the wrong case (which *works* on Windows, but won't on other
// platforms).
if (p_mode_flags == READ) {
WIN32_FIND_DATAW d = { 0 };
HANDLE f = FindFirstFileW(path.c_str(), &d);
if (f) {
String fname = d.cFileName;
if (fname != String()) {
String base_file = path.get_file();
if (base_file != fname && base_file.findn(fname) == 0) {
WARN_PRINTS("Case mismatch opening requested file '" + base_file + "', stored as '" + fname + "' in the filesystem. This file will not open when exported to other case-sensitive platforms.");
}
}
FindClose(f);
}
}
#endif

@Kanabenki
Copy link
Contributor

I implemented the warning, but I don't have a mac right now to check if it works properly. I will test on one this afternoon and make a PR if it works as intended.

@EmrysMyrddin EmrysMyrddin linked a pull request Jan 9, 2019 that will close this issue
EmrysMyrddin added a commit to EmrysMyrddin/godot that referenced this issue Feb 13, 2024
When a file is opened with a wrong case, it can work on the developer system but
but break on a user system with a casesensitive filesystem.

This will display a warning when it happens.

CAVEATS : It will also display the warning if a symlink is present somewhere in the path.

Fixes godotengine#23441
EmrysMyrddin added a commit to EmrysMyrddin/godot that referenced this issue Mar 7, 2024
When a file is opened with a wrong case, it can work on the developer system but
but break on a user system with a casesensitive filesystem.

This will display a warning when it happens.

CAVEATS : It will also display the warning if a symlink is present somewhere in the path.

Fixes godotengine#23441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants