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

LibCore: Port Directory to Windows #2188

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stasoid
Copy link
Contributor

@stasoid stasoid commented Nov 6, 2024

This PR requires #1918.
This PR is ready for review, but must be rebased before merging. First 3 commits belong to #1918. Update: rebased.

NOTE: The only methods of Directory that are used are create (static), is_valid_directory (static), chown and path, also adopt_fd and is_valid_directory are used internally.
The most used method is create, and it is always called with Directory::CreateDirectories::Yes.
Directory::is_valid_directory is called externally only from Web::ResourceLoader::load.
Directory::chown is called only from SessionManagement::create_session_temporary_directory_if_needed.
Directory::path is called only from ConfigFile::open_for_lib and other ConfigFile methods (indirectly through Formatter<Directory>::format).
Among these, only chown uses m_directory_fd. As chown is not implemented on Windows, m_directory_fd is essentially not used. I implemented directory support in System::open only to satisfy internal Directory checks. Without it Directory::create creates the actual directory, but returns an error.

@ladybird-bot
Copy link
Collaborator

Hello!

One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

size >> 31 >> 1 is used instead of size >> 32 to support 32-bit Windows
(size_t is 32 bit there, and you cannot shift 32-bit value by 32 bits
on x86)
This is equivalent to sizeof(size) == 4 ? 0 : size >> 32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants