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

File Type association, Register CogTool as a Viewer and Editor of .cgt files #20

Open
justingeeslin opened this issue Jun 11, 2020 · 5 comments · May be fixed by #68
Open

File Type association, Register CogTool as a Viewer and Editor of .cgt files #20

justingeeslin opened this issue Jun 11, 2020 · 5 comments · May be fixed by #68
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement New feature or request help wanted Extra attention is needed

Comments

@justingeeslin
Copy link
Member

justingeeslin commented Jun 11, 2020

Issuehunt badges

The CogTool.app does not register any associated file types.

Would be more convenient to have CogTool open when opening a .cgt file instead of the user receiving a prompt like the one below.
Screen Shot 2020-06-10 at 10 48 28 PM


IssueHunt Summary

Backers (Total: $20.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips

@justingeeslin justingeeslin added the enhancement New feature or request label Jun 11, 2020
@justingeeslin
Copy link
Member Author

Interestingly. CogTool has had this issue for a while per a user request back in 2006 found in the original documentation.

@justingeeslin
Copy link
Member Author

The feature branch feature/file-association-from-master has CogTool opening on the double-click of a CGT file, but it does not actually open the file once CogTool is launched. This is progress. Being a SWT application I'm at present unfamiliar with how to move this forward.

@justingeeslin justingeeslin added the help wanted Extra attention is needed label Jul 2, 2020
@issuehunt-oss
Copy link

issuehunt-oss bot commented Apr 22, 2021

@justingeeslin has funded $20.00 to this issue.


@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Apr 22, 2021
@PSeQXh
Copy link

PSeQXh commented Apr 25, 2021

No expert here (and no macintosh to test changes), but your bounty got me looking into this :-) Interesting tool.
As far as I understand it, CogTool gets packaged into a MacOS app by copying some form of app template
(here

<!-- Create a Mac "app" bundle by copying the tmp bundle. -->
)
The app template essentially does register the shell script cogtoolstart as a new application.
When running the application this cogtoolstart shell script then executes CogTool.jar inside a JVM.

Based on the assumption that, when double-clicking any file on MacOS, MacOS passes the filename (and path?)
to the default application associated with this file type, based on https://stackoverflow.com/a/4772856
and based on your commit in the mentioned feature branch above to associate CGT files with CogTool
(d38510c)
I created the pull request referenced above (#68)

Unfortunately, I have no way of testing the result.
It could be, that only the filename is passed and then due to the directory change in cogtoolstart JVM/CogTool.jar does not find the file anymore. If this is the case, this could be useful knowledge for getting the full filepath into CogTool.jar: https://stackoverflow.com/a/19633453 and some logging at

filesToLoad.add((String)obj);
could help.
Maybe you could test the changes in the pull request and let me know if this resolves your issue?

@justingeeslin
Copy link
Member Author

Thanks so much for taking on this issue! I've tested the code from PR #68 and can confirm that CogTool does open, but does not open the file. But I think we're getting closer.

I've added some logging in CogTool.java as you suggested. In my testing, line 272 and onwards looks like the following.

OptionParser parser = new OptionParser("f:i:re:s:qQ");
            // The psn is supplied on MacOS when a GUI application is double-clicked;
            // we just ignore it, but need to recognize it so we can ignore it.
            parser.accepts("psn", "process serial number (ignored)").withRequiredArg();
            
            MessageBox box = new MessageBox(WindowUtil.GLOBAL_DISPLAY.getActiveShell(), SWT.CANCEL | SWT.OK);
            box.setText("DEBUG");
            box.setMessage("args: " + Arrays.toString(args));

            box.open();
            
            OptionSet opts = parser.parse(args);

The message box comes back with an empty array. args appears to be an empty array at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants