1
1
Fork
You've already forked zop
0

Fix Android startup issues (Issue #27) #33

Merged
peterwwillis merged 4 commits from fix-android-startup into main 2026年03月22日 00:28:06 +01:00
peterwwillis commented 2026年03月21日 23:33:33 +01:00 (Migrated from github.com)
Copy link

This PR improves path robustness for Android and other environments where home/config directories might be missing or inaccessible. It also updates the mobile entry point to use Fyne's storage API for configuration and session data.

This PR improves path robustness for Android and other environments where home/config directories might be missing or inaccessible. It also updates the mobile entry point to use Fyne's storage API for configuration and session data.
gemini-code-assist[bot] commented 2026年03月21日 23:33:58 +01:00 (Migrated from github.com)
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1 ! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the application's startup robustness and portability, particularly for Android and similar mobile environments. By centralizing configuration and session data management through Fyne's storage API and implementing more resilient path resolution strategies, the application can now reliably locate and store its necessary files even when traditional user directories are absent or inaccessible. This change ensures a smoother and more consistent user experience across diverse deployment scenarios.

Highlights

  • Improved Path Robustness: Implemented robust path resolution for configuration and session data, specifically addressing environments like Android where standard home/config directories might be unavailable or inaccessible.
  • Fyne Storage API Integration: Updated the mobile application's entry point to leverage Fyne's internal storage API for managing application-specific configuration and session data paths.
  • Portable Model Paths: Ensured model paths for Whisper and TTS are set relative to the application's configuration directory, enhancing portability across different operating systems and environments.
  • Enhanced Directory Fallback: Improved fallback mechanisms for determining user configuration and cache directories, making the application more resilient to varying system configurations and potential errors in directory resolution.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩︎

## Summary of Changes Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the application's startup robustness and portability, particularly for Android and similar mobile environments. By centralizing configuration and session data management through Fyne's storage API and implementing more resilient path resolution strategies, the application can now reliably locate and store its necessary files even when traditional user directories are absent or inaccessible. This change ensures a smoother and more consistent user experience across diverse deployment scenarios. ### Highlights * **Improved Path Robustness**: Implemented robust path resolution for configuration and session data, specifically addressing environments like Android where standard home/config directories might be unavailable or inaccessible. * **Fyne Storage API Integration**: Updated the mobile application's entry point to leverage Fyne's internal storage API for managing application-specific configuration and session data paths. * **Portable Model Paths**: Ensured model paths for Whisper and TTS are set relative to the application's configuration directory, enhancing portability across different operating systems and environments. * **Enhanced Directory Fallback**: Improved fallback mechanisms for determining user configuration and cache directories, making the application more resilient to varying system configurations and potential errors in directory resolution. <details> <summary><b>Using Gemini Code Assist</b></summary> <br> The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips. <b>Invoking Gemini</b> You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page. Feature | Command | Description --- | --- | --- Code Review | `/gemini review` | Performs a code review for the current pull request in its current state. Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state. Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. Help | `/gemini help` | Displays a list of available commands. <b>Customization</b> To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). <b>Limitations & Feedback</b> Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG). </details> [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
gemini-code-assist[bot] (Migrated from github.com) reviewed 2026年03月21日 23:36:11 +01:00
gemini-code-assist[bot] (Migrated from github.com) left a comment
Copy link

Code Review

This pull request effectively improves path handling to be more robust, especially for environments like Android where standard directory structures may not be available. The changes correctly use Fyne's storage API for mobile builds and add sensible fallbacks for locating configuration, session, and model files. My review includes a few suggestions to further align the code with platform conventions and to simplify some of the path resolution logic.

## Code Review This pull request effectively improves path handling to be more robust, especially for environments like Android where standard directory structures may not be available. The changes correctly use Fyne's storage API for mobile builds and add sensible fallbacks for locating configuration, session, and model files. My review includes a few suggestions to further align the code with platform conventions and to simplify some of the path resolution logic.
@ -250,3 +250,2 @@
funcDefaultConfigPath()string{
ifxdg:=os.Getenv("XDG_CONFIG_HOME");xdg!=""{
returnfilepath.Join(xdg,"zop","config.toml")
// Try UserConfigDir first as it's more standard on modern systems.
gemini-code-assist[bot] (Migrated from github.com) commented 2026年03月21日 23:36:11 +01:00
Copy link

medium

The explicit check for XDG_CONFIG_HOME is redundant because os.UserConfigDir() already implements the XDG Base Directory Specification, which includes checking this environment variable. You can simplify this function by removing the redundant check.

 if configDir, err := os.UserConfigDir(); err == nil {
 return filepath.Join(configDir, "zop", "config.toml")
 }
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) The explicit check for `XDG_CONFIG_HOME` is redundant because `os.UserConfigDir()` already implements the XDG Base Directory Specification, which includes checking this environment variable. You can simplify this function by removing the redundant check. ```suggestion if configDir, err := os.UserConfigDir(); err == nil { return filepath.Join(configDir, "zop", "config.toml") } ```
@ -195,9 +195,12 @@ func defaultModelPath() string {
ifp:=os.Getenv("ZOP_TTS_MODEL");p!=""{
gemini-code-assist[bot] (Migrated from github.com) commented 2026年03月21日 23:36:11 +01:00
Copy link

medium

Model files are typically considered data or cache, not user-editable configuration. Storing them in the directory provided by os.UserConfigDir() is unconventional. It would be better to use os.UserCacheDir() for downloadable assets that can be regenerated. This would also align with platform best practices and be more consistent with internal/chat/session.go, which also uses a cache directory.

 if cacheDir, err := os.UserCacheDir(); err == nil {
 return filepath.Join(cacheDir, "zop", "tts")
 }
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) Model files are typically considered data or cache, not user-editable configuration. Storing them in the directory provided by `os.UserConfigDir()` is unconventional. It would be better to use `os.UserCacheDir()` for downloadable assets that can be regenerated. This would also align with platform best practices and be more consistent with `internal/chat/session.go`, which also uses a cache directory. ```suggestion if cacheDir, err := os.UserCacheDir(); err == nil { return filepath.Join(cacheDir, "zop", "tts") } ```
@ -59,6 +59,9 @@ func defaultModelPath() string {
ifp:=os.Getenv("ZOP_WHISPER_MODEL");p!=""{
gemini-code-assist[bot] (Migrated from github.com) commented 2026年03月21日 23:36:11 +01:00
Copy link

medium

Model files are typically considered data or cache, not user-editable configuration. Storing them in the directory provided by os.UserConfigDir() is unconventional. It would be better to use os.UserCacheDir() for downloadable assets that can be regenerated. This would also align with platform best practices.

 if cacheDir, err := os.UserCacheDir(); err == nil {
 return filepath.Join(cacheDir, "zop", "whisper", "ggml-base.en.bin")
 }
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) Model files are typically considered data or cache, not user-editable configuration. Storing them in the directory provided by `os.UserConfigDir()` is unconventional. It would be better to use `os.UserCacheDir()` for downloadable assets that can be regenerated. This would also align with platform best practices. ```suggestion if cacheDir, err := os.UserCacheDir(); err == nil { return filepath.Join(cacheDir, "zop", "whisper", "ggml-base.en.bin") } ```
github-actions[bot] commented 2026年03月22日 00:05:07 +01:00 (Migrated from github.com)
Copy link

Mobile UI Screenshot

zop mobile UI

### Mobile UI Screenshot ![zop mobile UI](https://raw.githubusercontent.com/peterwwillis/zop/ui-screenshots/pr-33/zop-mobile-ui.png) <!-- Sticky Pull Request Commentzop-mobile-ui -->
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mutablecc/zop!33
Reference in a new issue
mutablecc/zop
No description provided.
Delete branch "fix-android-startup"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?