Skip to content

Specifiy return value in several store methods in FileAccess #107938

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

Merged
merged 1 commit into from
Jun 28, 2025

Conversation

krishnabm
Copy link
Contributor

Some of the store methods did not specify the nature of return bool value. Added it after referring to FileAccess.cpp method.

@krishnabm krishnabm requested a review from a team as a code owner June 24, 2025 14:29
@krishnabm
Copy link
Contributor Author

Helps with users cleaning up RETURN_VALUE_DISCARDED gdscript warnings in a jiffy.

@Mickeon
Copy link
Member

Mickeon commented Jun 24, 2025

It's not a good idea to make a whole new line for this. The sentence should be merged with the first line.

Although, since this is common information, it may be worth mentioning it once and for all in the leading description.

@Mickeon Mickeon added this to the 4.x milestone Jun 24, 2025
@AThousandShips AThousandShips changed the title Specified return value in several store methods in FileAccess Specifiy return value in several store methods in FileAccess Jun 24, 2025
@krishnabm
Copy link
Contributor Author

krishnabm commented Jun 24, 2025

It's not a good idea to make a whole new line for this. The sentence should be merged with the first line.

Although, since this is common information, it may be worth mentioning it once and for all in the leading description.

Done. I couldn't find a suitable reference for adding this in the leading description of the method definitions. Let me know if this would make sense somewhere specific and I can include the following line in the description -
All store_* methods return a boolean value indicating success of the operation.

On the other hand, I feel it would be consistent to return the Error enum similar to other set_ and get_ methods. Is this something that can be added to the issue tracker? Also will it break backward compatibility?

@Mickeon
Copy link
Member

Mickeon commented Jun 24, 2025

On the other hand, I feel it would be consistent to return the Error enum similar to other set_ and get_ methods. Is this something that can be added to the issue tracker? Also will it break backward compatibility?

A quick skim through the code tells me the store methods may not need that much granularity. It would also break compatibility, indeed. Either way that's outside the scope of this PR.

@krishnabm krishnabm closed this Jun 24, 2025
@krishnabm krishnabm reopened this Jun 24, 2025
@bruvzg
Copy link
Member

bruvzg commented Jun 24, 2025

A quick skim through the code tells me the store methods may not need that much granularity.

Undelaying platform API is also quite inconsistent and in many cases not capable of specifying exact reason of failure. Also, there's not much difference for the user. If the file write operation fails, the only thing you can do is close the file, it's non-recoverable.

@krishnabm
Copy link
Contributor Author

So can this be merged then?
Let me know if there is anything else I need to do

@Mickeon Mickeon modified the milestones: 4.x, 4.5 Jun 26, 2025
@krishnabm
Copy link
Contributor Author

Thanks!

@Repiteo
Copy link
Contributor

Repiteo commented Jun 27, 2025

Could you squash your commits? See our PR Workflow for more details:
https://docs.godotengine.org/en/stable/contributing/workflow/pr_workflow.html#the-interactive-rebase

Some of the store methods did not specify the nature of return bool value.
Added it after referring to FileAccess.cpp method.

Moved return statement to preceding paragraph

Addressed comments: Moved return description to first line
@krishnabm
Copy link
Contributor Author

Could you squash your commits? See our PR Workflow for more details: https://docs.godotengine.org/en/stable/contributing/workflow/pr_workflow.html#the-interactive-rebase

Thanks and done, will keep this in mind for the next time

@akien-mga akien-mga merged commit b9f0580 into godotengine:master Jun 28, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

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.

5 participants