Skip to content

Implement get_filesystem_type on macOS and Linux.#106386

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
bruvzg:mac_fs_name
May 26, 2025
Merged

Implement get_filesystem_type on macOS and Linux.#106386
Repiteo merged 1 commit into
godotengine:masterfrom
bruvzg:mac_fs_name

Conversation

@bruvzg
Copy link
Copy Markdown
Member

@bruvzg bruvzg commented May 14, 2025

Should fix #106384

Note: there is the same function on Linux and BSDs, but returned data (and used header) seems to be different, and Linux version only contain magic numbers for the file system types.

@bruvzg bruvzg added this to the 4.5 milestone May 14, 2025
@bruvzg bruvzg requested review from a team as code owners May 14, 2025 08:38
@akien-mga
Copy link
Copy Markdown
Member

So I assume the same bug as #106384 might be reproducible on Linux?

@bruvzg
Copy link
Copy Markdown
Member Author

bruvzg commented May 14, 2025

So I assume the same bug as #106384 might be reproducible on Linux?

Probably yes it seems to be a generic limitation of exFAT (#28467), but detecting exFAT/FAT will require adding a hardcoded list of magic numbers and likely a dedicated implementation for each BSD flavor. I'll check it later.

@akien-mga
Copy link
Copy Markdown
Member

I think if we support Linux and not the various BSDs for this niche scenario, it's probably fine.

@bruvzg bruvzg requested a review from a team as a code owner May 14, 2025 10:07
@bruvzg
Copy link
Copy Markdown
Member Author

bruvzg commented May 14, 2025

Added Linux version as well, tested to detect exFAT, FAT32, and genetic FS like EXT and BTRFS. The list is copy-pasted from the header. But it seems to not work with FUSE (return generic FUSE type).

@bruvzg bruvzg changed the title Implement get_filesystem_type on macOS. Implement get_filesystem_type on macOS and Linux. May 14, 2025
Comment thread doc/classes/DirAccess.xml Outdated
Copy link
Copy Markdown
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on macOS, it works as expected. Code looks good to me.

func _ready():
	var da = DirAccess.open("res://")
	print(da.get_filesystem_type())
	print(da.is_case_sensitive("res://"))

Prints:

APFS
false

@Repiteo Repiteo merged commit 6132792 into godotengine:master May 26, 2025
20 checks passed
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented May 26, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On MacOS, filesystem docker won't refresh upon filesystem changes if project is located on an ExFAT drive

4 participants