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] Does not associate .starc extension with Starc #88

Closed
hyuri opened this issue Apr 26, 2023 · 22 comments · Fixed by flathub/dev.storyapps.starc#25
Closed

[Bug] Does not associate .starc extension with Starc #88

hyuri opened this issue Apr 26, 2023 · 22 comments · Fixed by flathub/dev.storyapps.starc#25
Labels
bug Something isn't working

Comments

@hyuri
Copy link
Contributor

hyuri commented Apr 26, 2023

Starc does not associate itself with the .starc extension. No proper file icon is associated with .starc files either.

.starc files are recognized as SQLite3 files, display a database icon and, when I click on a .starc file, the system tries to open the file with an app it thinks supports SQLite3 files, instead of Starc.

Expectations:

Clicking on a .starc file should open it in Starc. Also, .starc files should also be recognized as associated with Starc, and should display the appropriate file icon in file browsers.

When installing, Starc should set up these associations.

App Info

  • Starc v0.5.0a (Flatpak)

System Info

  • Pop!_OS 22.04
  • X11
@dimkanovikov dimkanovikov added the bug Something isn't working label May 3, 2023
@dimkanovikov
Copy link
Member

dimkanovikov commented May 3, 2023

Since the app sandboxed in Flatpak it can't register itself as a default app for any kind of files. But we should provide instruction about how to do it manually (something like jgraph/drawio-desktop#363). Plus we can add instruction about how to add AppImage file to the Applications menu (for Linux and ChromeOS), something like this.

@hyuri
Copy link
Contributor Author

hyuri commented May 3, 2023

Kdenlive Flatpak seems to be able to do it. Maybe they know a trick?

@dimkanovikov
Copy link
Member

Will check it, thanks!

@hyuri
Copy link
Contributor Author

hyuri commented May 9, 2023

Thinking here... worst case scenario, if you make the file type unique so it doesn't advertise itself as an SQLite3 file, I think we will probably be able to select Story Architect to open it and the system will remember that association from there on, no?

Is there an easy way you can make the file header say "This is a Starc file" instead of "This is a SQLite3 file" while still keeping Story Architect's ability to open it as SQLite3?

@joshua-stone
Copy link

I believe this should be possible to fix, given that there are numerous apps that include their own filetype associations:

https://github.com/search?q=org%3Aflathub%20%3Cmime-info%20xmlns%3D%22http%3A%2F%2Fwww.freedesktop.org%2Fstandards%2Fshared-mime-info%22%3E&type=code

@dimkanovikov
Copy link
Member

I believe this should be possible to fix, given that there are numerous apps that include their own filetype associations:

https://github.com/search?q=org%3Aflathub%20%3Cmime-info%20xmlns%3D%22http%3A%2F%2Fwww.freedesktop.org%2Fstandards%2Fshared-mime-info%22%3E&type=code

Okay, I added the file with mime info to the repo. Now we should install it somehow?

@joshua-stone
Copy link

I believe the mimetype file should reside in share/mime/packages/dev.storyapps.starc.mime.xml inside the AppImage, that way it can be easily copied along the other files during the flatpak build process:

diff --git a/dev.storyapps.starc.yml b/dev.storyapps.starc.yml
index 7251cf4..e651b3f 100644
--- a/dev.storyapps.starc.yml
+++ b/dev.storyapps.starc.yml
@@ -24,11 +24,13 @@ modules:
       - cp squashfs-root/starc.desktop                                      ${FLATPAK_ID}.desktop
       - cp squashfs-root/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png ${FLATPAK_ID}.png
       - cp squashfs-root/share/metainfo/${FLATPAK_ID}.metainfo.xml          ${FLATPAK_ID}.metainfo.xml
+      - cp squashfs-root/share/mime/packages/${FLATPAK_ID}.mime.xml         ${FLATPAK_ID}.mime.xml
       - desktop-file-edit --set-icon ${FLATPAK_ID} --set-key Exec --set-value 'starc-run
         %u' ${FLATPAK_ID}.desktop
       - install -Dm644 ${FLATPAK_ID}.desktop      -t ${FLATPAK_DEST}/share/applications
       - install -Dm644 ${FLATPAK_ID}.png          -t ${FLATPAK_DEST}/share/icons/hicolor/512x512/apps
       - install -Dm644 ${FLATPAK_ID}.metainfo.xml -t ${FLATPAK_DEST}/share/metainfo
+      - install -Dm644 ${FLATPAK_ID}.mime.xml     -t ${FLATPAK_DEST}/share/mime/packages
       - install -Dm755 starc-run                  -t ${FLATPAK_DEST}/bin
       - mv squashfs-root ${FLATPAK_DEST}/bin/starc
     sources:

@dimkanovikov
Copy link
Member

Done

@hyuri
Copy link
Contributor Author

hyuri commented Jun 9, 2023

It does open the .starc file with Starc when I click on it, but it immediately crashes.

I noticed the following log when running through the terminal (xdg-open file.starc):

2023.06.09 13:26:18.068 [D] Failed to write minidump, dump path: ~/.var/app/dev.storyapps.starc/data/Story Apps/Story Architect/crashreports/c4ad6038-a08d-4545-da9066b1-554ca98f.dmp

/app/bin/starc-run: line 2:     3 Segmentation fault      (core dumped) /app/bin/starc/starc $@

I guess I should report it as a separate issue?

@joshua-stone
Copy link

Where are you opening that file? AFAIK it only has access to files within ~/Documents:

https://github.com/flathub/dev.storyapps.starc/blob/2b4f258bd11224e55245e64a1fdd9d7d001b5400/dev.storyapps.starc.yml#L7

@hyuri
Copy link
Contributor Author

hyuri commented Jun 9, 2023

On the Desktop. I added permission to 'xdg-desktop` using Flatseal.

@joshua-stone
Copy link

Where on the desktop?

Can you make sure the file is moved into the documents folder and have it be opened here?

$ xdg-open ~/Documents/file.starc

@hyuri
Copy link
Contributor Author

hyuri commented Jun 9, 2023

~/Desktop/file.starc

Just move it to ~/Documents/file.starc and tried opening it there.

Same result: crash. Tried both clicking on the file, and the xdg-open command you shared above.

@joshua-stone
Copy link

joshua-stone commented Jun 9, 2023

@dimkanovikov It looks like the mimetype has to match the MimeType property in the .desktop file:

$ cp dev.storyapps.starc.mime.xml ~/.local/share/mime/packages/
$ update-mime-database ~/.local/share/mime -V
Updating MIME database in /var/home/jstone/.local/share/mime...

Parsing source file /var/home/jstone/.local/share/mime/packages/dev.storyapps.starc.mime.xml...
Wrote 3 strings at 2c - 6c
Wrote aliases at 6c - 70
Wrote parents at 70 - 84
Wrote literal globs at 84 - 88
Wrote suffix globs at 88 - e4
Wrote full globs at e4 - e8
Wrote magic at e8 - f4
Wrote namespace list at f4 - f8
Wrote icons list at f8 - 104
Wrote generic icons list at 104 - 110
Wrote types list at 110 - 118
$ xdg-open ~/Documents/starc/projects/Starc.starc 
gio: file:///var/home/jstone/Documents/starc/projects/Starc.starc: Failed to find default application for content type ‘application/x-starc’

@dimkanovikov
Copy link
Member

dimkanovikov commented Jun 12, 2023

My bad... Now mime types equal in both files.

@joshua-stone
Copy link

Looks good to me. I'll update the flatpak build manifest once the mimetype file is included in a new release.

@dimkanovikov
Copy link
Member

Nice, thanks!

@joshua-stone
Copy link

The latest update should have resolved this now.

@hyuri
Copy link
Contributor Author

hyuri commented Jul 6, 2023

Nice! Thanks, @joshua-stone!

@hyuri hyuri closed this as completed Jul 6, 2023
@hyuri
Copy link
Contributor Author

hyuri commented Jul 6, 2023

Association confirmed:
image

But the crash still happens for me when I click on a .starc file or by running xdg-open path/to/file.starc via terminal. Is it working for you?

The terminal output is:

2023.07.06 13:08:57.861 [I] Story Architect version 0.5.4, Freedesktop.org SDK 22.08 (Flatpak runtime), x86_64
2023.07.06 13:08:57.861 [I] Loading fonts
2023.07.06 13:08:58.069 [W] QFont::setPixelSize: Pixel size <= 0 (0)
2023.07.06 13:08:58.074 [W] QFont::setPixelSize: Pixel size <= 0 (0)
2023.07.06 13:08:58.075 [W] QFont::setPixelSize: Pixel size <= 0 (0)
2023.07.06 13:08:58.078 [W] QFont::setPixelSize: Pixel size <= 0 (0)
2023.07.06 13:08:58.078 [W] QFont::setPixelSize: Pixel size <= 0 (0)
2023.07.06 13:08:58.110 [W] QFont::setPixelSize: Pixel size <= 0 (0)
2023.07.06 13:08:58.183 [I] Starting the application
2023.07.06 13:08:58.183 [I] Setup translation for en
2023.07.06 13:08:58.185 [I] Setup design system theme
2023.07.06 13:08:58.185 [I] Setup design system scale factor
2023.07.06 13:08:58.185 [I] Setup design system density
2023.07.06 13:08:58.234 [I] Show application window
2023.07.06 13:08:58.323 [I] Make startup checks
2023.07.06 13:08:58.324 [I] Starting cloud service connection
2023.07.06 13:08:58.324 [I] Configure autosaving
2023.07.06 13:08:58.332 [I] Show projects screen
2023.07.06 13:08:58.332 [D] Show content: Ui::ProjectsToolBar, Ui::ProjectsNavigator, Ui::ProjectsView
2023.07.06 13:08:58.349 [I] Closing current project
2023.07.06 13:08:58.350 [W] Current project is not valid. Skip closing.
2023.07.06 13:08:58.498 [I] Activate plugin "" (default "application/x-starc/editor/project/information")
2023.07.06 13:08:58.499 [D] Activate plugin view
2023.07.06 13:08:58.742 [D] Activate plugin view options
2023.07.06 13:08:58.742 [D] Activate plugin manager
2023.07.06 13:08:58.742 [I] Plugin activated
2023.07.06 13:08:58.753 [D] Failed to write minidump, dump path: ~/.var/app/dev.storyapps.starc/data/Story Apps/Story Architect/crashreports/aa427533-c8be-421f-06bf87a4-e75c3130.dmp

/app/bin/starc-run: line 2:     3 Segmentation fault      (core dumped) /app/bin/starc/starc $@

After it crashes and I click on the .starc file again, the app opens but displays this dialog:
image

Even though the project is not open and no other Starc instances are running (I checked running processes in the System Monitor).

Is this a different issue — should I file a new report?

@joshua-stone
Copy link

You may have to delete the lock file that's created by Starc:

image

Make sure you kill any old instances of Starc as well:

$ flatpak kill dev.storyapps.starc

And make sure you have granted filesystem access to the required directory with Flatseal, or run the following:

$ flatpak override --user --filesystem=home dev.storyapps.starc

@hyuri
Copy link
Contributor Author

hyuri commented Jul 6, 2023

I just figured out what the issue is: spaces in the file name.

The moment I renamed Test Story.starc to Test_Story.starc, the file opened perfectly.

The lock file created for Test Story.starc is named .~lock.Test and not .~lock.Test Story.starc.
image

Note: I tried deleting the lock as you suggested, still crashed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants