When launching the script, actually source the right things.
If I try to launch it via ~/projects/audiogame-manager/audiogame-manager.sh it will crap out because it isn't able to source its include files; it erroneously thinks they're in the current directory as I am, which is no exactly true unless I physically go to the audiogame manager directory. This also fixes launching from the desktop icon.
This commit is contained in:
@@ -104,7 +104,10 @@ for f in .includes/*.sh; do bash -n "$f"; done
|
||||
- Examples: `get_wine_bottle()`, `process_launcher_flags()`, `download_file()`
|
||||
- Never use: `getWineBottle()`, `processLauncherFlags()`, `downloadFile()`
|
||||
- **Shebang**: Use `#!/bin/bash` for all bash scripts
|
||||
- **Sourcing pattern**: Use modular sourcing: `. "${0%/*}/.includes/file.sh"`
|
||||
- **Sourcing pattern**:
|
||||
- **Main script** (`audiogame-manager.sh`): Use `source "${scriptDir}/.includes/file.sh"` (scriptDir is defined at line 4)
|
||||
- **Subdirectory scripts** (game-scripts/, wine/, speech/): Use `source "${0%/*}/../.includes/file.sh"`
|
||||
- **CRITICAL**: Never use relative paths like `source .includes/file.sh` - these fail when the current working directory differs from the script location
|
||||
- **Indentation**: Use consistent indentation (tabs or spaces, follow existing file patterns)
|
||||
- When fixing code, correct any indentation inconsistencies to match the established style
|
||||
|
||||
@@ -194,6 +197,7 @@ The project has undergone a significant refactor to modularize functionality. **
|
||||
2. **Variable scope**: Added `export game` in main script so `.includes/bottle.sh` functions can access it
|
||||
3. **Installation logic**: Completed the `-I` option implementation for noninteractive game installation
|
||||
4. **Code deduplication**: Removed duplicate `check_news` and launcher logic from `update.sh`
|
||||
5. **Include sourcing**: Fixed all relative path sourcing (e.g., `source .includes/bottle.sh`) to use `${scriptDir}` to ensure desktop launchers and execution from any working directory works correctly
|
||||
|
||||
### Critical Variable Handling
|
||||
- **`$game` variable**: Must be exported when set (line 489 in main script) for bottle.sh functions to work
|
||||
|
||||
Reference in New Issue
Block a user