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

Bug in comwin_open_file disallows some files to be opened #107

Closed
SamSandq opened this issue Feb 24, 2024 · 1 comment
Closed

Bug in comwin_open_file disallows some files to be opened #107

SamSandq opened this issue Feb 24, 2024 · 1 comment
Assignees

Comments

@SamSandq
Copy link

SamSandq commented Feb 24, 2024

A subtle bug in the Mac version... in the call to open a file one may include file types, like in

    const char_t *type[] = {"sqlite", "db"};
    const char_t *file = comwin_open_file(app->window, type, 2, NULL);
    if (file != NULL) {
        
        bstd_printf("Chose: %s\n", file);

This does not work on the Mac in the example above because the file type sqliteand dbare not registered file types. However, they do exist and the files should be available for opening.

Correct the oversight by changed, in oscomwin.m, function i_set_ftypes:

change the line
UTType *type = [UTType typeWithIdentifier:ext];
to
UTType *type = [UTType typeWithFilenameExtension:ext];

This will allow any file with the indicated extensions to be opened, not only registered ones.

@frang75 frang75 self-assigned this Feb 24, 2024
@frang75
Copy link
Owner

frang75 commented Feb 24, 2024

Thanks @SamSandq for reporting!

Fixed in this commit: 32acdb5

Tested with Product demo app

static void i_OnImport(Ctrl *ctrl, Event *e)
{
    const char_t *type[] = { "dbp" };
    const char_t *file = comwin_open_file(ctrl->window, type, 1, NULL);
    ...
dbp_files

@frang75 frang75 closed this as completed Feb 24, 2024
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

No branches or pull requests

2 participants