-
Notifications
You must be signed in to change notification settings - Fork 228
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
Overwrite export #362
Overwrite export #362
Conversation
Thanks. it looks good. A few changes are needed (I assume you can git push -f into your branch? I never really used github PR):
can be simplified to:
I think it would indeed make sense to store the export format in addition to the path like you suggested. Maybe you can look at this after we merge this pull request. |
Hello,
As for continuing the pull request, all I have to do is push changes into my local branch and they will show up here, so no worries. I'll implement the changes and improvements later today. |
On Wed, Mar 20, 2024 at 4:42 PM Madd Games ***@***.***> wrote:
Hello,
My username is madd-games and the files is called madd-games.md, but my legal name is Mariusz Pilipczuk which is what I added to the declaration. I pushed with the same settings on both branches. Is another declaration still needed? If so, tell me the file name and which name I should use (legal or madd-games).
Ah I see. Well should be fine then. I was just a bit confused in the
commit logs to see two names.
This code cannot be simplified, because like the comment states, a_overwrite_export() calls goxel_export_to_file(goxel.image->export_path, NULL), so path is the same pointer as goxel.image->export_path. Thus, if I free(goxel.image->export_path);, that's the same as free(path), and we're immediately calling strdup(path) afterwards, thus using a freed pointer. I actually tried the simple way initially and encountered the memory issue.
OK I see! Why can they be the same though? Need to check that and
simplify if possible, cause here it's quite confusing otherwise. Do
you think you can fix that? If not ok, leave it like you did.
Thanks again for the work.
Cheers.
|
It's equal because we want to use the already existing I do agree that it's a little awkward to have to use the |
Right, I didn't read the code properly. Tricky indeed.
…On Wed, Mar 20, 2024 at 5:09 PM Madd Games ***@***.***> wrote:
It's equal because we want to use the already existing export_path when
using 'overwrite export'. The only other solution I can think of would be
to call strdup() and free() inside a_overwrite_export(); but that might
be more confusing than the current approach.
I do agree that it's a little awkward to have it there, but I just don't
have another idea for now.
—
Reply to this email directly, view it on GitHub
<#362 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA2JH4FA6ZQXYFK25Q3ABDYZFG4BAVCNFSM6AAAAABE6CDJLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBZGA4DGMBSHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Let me know when I can merge then, I think this is good now. |
I think I fixed all the problems. I've changed I included the Thanks |
Should be fine. I merged the branch, thanks! |
This PR adds a menu entry which allows the user to overwrite the file at the stored export path.
I tried as much as possible to make it work like GIMP. It would appear that GIMP shows the
path
when saved,export_path
only if there is nopath
, and "Untitled" otherwise. It also has an "(exported)" label at the end of the title bar if there is anexport_path
(even if there is also apath
).I used
Ctrl+E
for export.One consideration, tho: should we store
file_format_t *export_format
inimage_t
alongside theexport_path
? I'm not certain how the save dialog works, but ingoxel_export_to_file()
, if the dialog were to return a path ending with, say.png
, but the format was "txt", it would actually export a TXT file with.png
extension. But then, hitting Ctrl+E would write it as PNG, since this time it detects the format based on the name. This is only if there is a possibility of the dialog returning the wrong extension tho.file_format.h
actually includesimage.h
, so if I were to implement this, I'd have to reference it asstruct file_format *export_format;
, unless you have some other suggestion.In any case, let me know.
NOTE: I do not actually speak French so please verify the translation if possible. Thanks.