Centralize build output and generate OS-specific startup.json

- All DLLs now output to lib\[Configuration]\[TargetFramework]\ at repo root (see Directory.Build.props)
- .gitignore updated to exclude /lib/
- On first run, startup.json is auto-generated with OS-appropriate default paths (Windows, Linux, macOS, or portable)
- Removes null/example config; generated config is immediately usable and clearly documented
- Extensive new documentation: build output, startup.json logic, visual guides, and code proofs
- Publish profile now deletes existing files for clean deploys
- No breaking changes: existing startup.json files are preserved
- Improves first-run UX, deployment, and cross-platform consistency
This commit is contained in:
2026-02-26 14:21:26 -05:00
parent 5bdb7d53c3
commit 8f860a8ec3
35 changed files with 2218 additions and 46 deletions
+157
View File
@@ -0,0 +1,157 @@
# Git Commit: OS-Specific startup.json Generation
## Summary
Implement automatic generation of OS-specific default paths in `startup.json` instead of null values.
## Files Modified
### `Jellyfin.Server/Helpers/StartupHelpers.cs`
**Method:** `CreateDefaultStartupConfiguration()`
**Changes:**
- Added OS detection using `OperatingSystem.IsWindows()`, `IsLinux()`, `IsMacOS()`
- Generate platform-appropriate default paths
- Removed confusing "Examples" section with null values
- Added clear comments explaining the configuration
- Improved console output to show which OS defaults were used
## Implementation Details
### Platform Detection Logic
```csharp
if (OperatingSystem.IsWindows())
{
// Windows: C:/ProgramData/jellyfin
}
else if (OperatingSystem.IsLinux())
{
// Linux: FHS-compliant paths
}
else if (OperatingSystem.IsMacOS())
{
// macOS: User Library paths
}
else
{
// Portable: Relative paths
}
```
### Generated Paths
| Platform | DataDir | ConfigDir | CacheDir | LogDir |
|----------|---------|-----------|----------|--------|
| Windows | `C:/ProgramData/jellyfin` | `C:/ProgramData/jellyfin` | `C:/ProgramData/jellyfin/cache` | `C:/ProgramData/jellyfin/log` |
| Linux | `/var/lib/jellyfin` | `/etc/jellyfin` | `/var/cache/jellyfin` | `/var/log/jellyfin` |
| macOS | `~/Library/Application Support/jellyfin` | `~/Library/Application Support/jellyfin/config` | `~/Library/Caches/jellyfin` | `~/Library/Logs/jellyfin` |
| Portable | `./data` | `./config` | `./cache` | `./logs` |
## Benefits
1. **Immediate Usability** - No configuration required for first run
2. **Platform Standards** - Follows OS conventions (FHS for Linux, ProgramData for Windows)
3. **Better UX** - Users don't need to research correct paths
4. **Clear Documentation** - Generated file includes helpful comments
5. **Still Customizable** - Users can edit paths if needed
6. **Backward Compatible** - Existing `startup.json` files are not affected
## Testing
### Build Status
✅ Solution builds successfully
### Test Scenarios
1. **Fresh Install (Windows)** - Creates `startup.json` with `C:/ProgramData/jellyfin` paths
2. **Fresh Install (Linux)** - Creates `startup.json` with FHS paths
3. **Existing Config** - Does not overwrite existing `startup.json`
4. **Custom Paths** - User edits are preserved
## Related Changes
This builds upon previous work:
- `STARTUP_CONFIG_UPDATE.md` - Updated `startup.default.json` with Linux defaults
- Created `startup.linux.json` and `startup.windows.json` templates in Resources/Configuration
## Documentation
Created:
- `OS_SPECIFIC_STARTUP_CONFIG.md` - Complete documentation of feature
- `STARTUP_CONFIG_COMPARISON.md` - Before/after comparison
## Console Output
### Before
```
Created default startup configuration at: ./startup.json
You can customize this file to set default paths for Jellyfin.
```
### After (Windows Example)
```
Created default startup configuration at: E:\Jellyfin\startup.json
Using Windows defaults - using C:/ProgramData/jellyfin
You can customize this file to set different paths for Jellyfin.
```
## Commit Message
```
feat: Generate OS-specific defaults in startup.json
Instead of creating startup.json with null values, automatically populate
with platform-appropriate default paths:
- Windows: C:/ProgramData/jellyfin
- Linux: FHS-compliant paths (/var/lib, /etc, /var/log)
- macOS: User Library paths
- Unknown/Portable: Relative paths
Benefits:
- Immediate usability without manual configuration
- Follows platform conventions and standards
- Improved user experience for first-time setup
- Clear documentation in generated file
- Still fully customizable
Changes:
- Enhanced CreateDefaultStartupConfiguration() in StartupHelpers.cs
- Added OS detection logic
- Improved console output messages
- Added comprehensive documentation
Fixes: User confusion about what values to use
Closes: Issue with null values in startup.json
```
## Git Commands
```bash
# Add changes
git add Jellyfin.Server/Helpers/StartupHelpers.cs
git add OS_SPECIFIC_STARTUP_CONFIG.md
git add STARTUP_CONFIG_COMPARISON.md
# Commit
git commit -m "feat: Generate OS-specific defaults in startup.json
Instead of null values, populate with platform-appropriate defaults.
See OS_SPECIFIC_STARTUP_CONFIG.md for details."
# Push
git push origin pgsql_testing_branch
```
## Breaking Changes
**None** - This is a backward-compatible change. Existing `startup.json` files are not modified.
## Future Work
- Add validation to check if paths are writable
- Add interactive path selection wizard
- Add migration tool for moving data between paths
---
**Status:** ✅ Ready to commit
**Breaking Changes:** None
**Documentation:** Complete
**Testing:** Build successful