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.
Fix Android startup issues (Issue #27) #33
fix-android-startup into main 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.
-
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. ↩︎
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.
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")
}
@ -195,9 +195,12 @@ func defaultModelPath() string {
ifp:=os.Getenv("ZOP_TTS_MODEL");p!=""{
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")
}
@ -59,6 +59,9 @@ func defaultModelPath() string {
ifp:=os.Getenv("ZOP_WHISPER_MODEL");p!=""{
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")
}
Mobile UI Screenshot
No due date set.
No dependencies set.
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?