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:
@@ -114,7 +114,7 @@ public static class StartupHelpers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a default startup.json configuration file with example paths commented out.
|
||||
/// Creates a default startup.json configuration file with OS-specific default paths.
|
||||
/// </summary>
|
||||
private static void CreateDefaultStartupConfiguration()
|
||||
{
|
||||
@@ -126,50 +126,70 @@ public static class StartupHelpers
|
||||
|
||||
try
|
||||
{
|
||||
// Determine OS-specific default paths
|
||||
string dataDir, configDir, cacheDir, logDir, tempDir, webDir;
|
||||
string osComment;
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
// Windows defaults - use ProgramData
|
||||
dataDir = "C:/ProgramData/jellyfin";
|
||||
configDir = "C:/ProgramData/jellyfin";
|
||||
cacheDir = "C:/ProgramData/jellyfin/cache";
|
||||
logDir = "C:/ProgramData/jellyfin/log";
|
||||
tempDir = Path.Combine(Path.GetTempPath(), "jellyfin");
|
||||
webDir = "C:/ProgramData/jellyfin/web";
|
||||
osComment = "Windows defaults - using C:/ProgramData/jellyfin";
|
||||
}
|
||||
else if (OperatingSystem.IsLinux())
|
||||
{
|
||||
// Linux defaults - use FHS standard paths
|
||||
dataDir = "/var/lib/jellyfin";
|
||||
configDir = "/etc/jellyfin";
|
||||
cacheDir = "/var/cache/jellyfin";
|
||||
logDir = "/var/log/jellyfin";
|
||||
tempDir = "/var/tmp/jellyfin";
|
||||
webDir = "/usr/share/jellyfin/web";
|
||||
osComment = "Linux defaults - following Filesystem Hierarchy Standard (FHS)";
|
||||
}
|
||||
else if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
// macOS defaults - use user Library
|
||||
var homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
dataDir = Path.Combine(homeDir, "Library", "Application Support", "jellyfin");
|
||||
configDir = Path.Combine(homeDir, "Library", "Application Support", "jellyfin", "config");
|
||||
cacheDir = Path.Combine(homeDir, "Library", "Caches", "jellyfin");
|
||||
logDir = Path.Combine(homeDir, "Library", "Logs", "jellyfin");
|
||||
tempDir = Path.Combine(Path.GetTempPath(), "jellyfin");
|
||||
webDir = Path.Combine(homeDir, "Library", "Application Support", "jellyfin", "web");
|
||||
osComment = "macOS defaults - using user Library paths";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unknown OS - use portable defaults
|
||||
dataDir = "./data";
|
||||
configDir = "./config";
|
||||
cacheDir = "./cache";
|
||||
logDir = "./logs";
|
||||
tempDir = "./temp";
|
||||
webDir = "./web";
|
||||
osComment = "Portable defaults - using relative paths";
|
||||
}
|
||||
|
||||
var defaultConfig = new
|
||||
{
|
||||
_comment = "Jellyfin Startup Configuration - Configure path locations for Jellyfin data, logs, cache, and more.",
|
||||
_documentation = "See FILE_BASED_STARTUP_CONFIG.md for complete documentation",
|
||||
_priority = "Command-line options > Environment variables > This file > Defaults",
|
||||
_comment = $"Jellyfin Startup Configuration - {osComment}",
|
||||
_note = "These paths will be used unless overridden by environment variables or command-line arguments",
|
||||
_priority = "Command-line args > Environment variables > This file > Built-in defaults",
|
||||
_examples = "See startup.linux.json or startup.windows.json in Resources/Configuration for other OS examples",
|
||||
Paths = new
|
||||
{
|
||||
DataDir = (string?)null,
|
||||
ConfigDir = (string?)null,
|
||||
CacheDir = (string?)null,
|
||||
LogDir = (string?)null,
|
||||
TempDir = (string?)null,
|
||||
WebDir = (string?)null
|
||||
},
|
||||
Examples = new
|
||||
{
|
||||
_comment = "Example configurations below - remove this Examples section when customizing",
|
||||
Linux = new
|
||||
{
|
||||
DataDir = "/var/lib/jellyfin",
|
||||
ConfigDir = "/etc/jellyfin",
|
||||
CacheDir = "/var/cache/jellyfin",
|
||||
LogDir = "/var/log/jellyfin",
|
||||
TempDir = "/var/tmp/jellyfin",
|
||||
WebDir = "/usr/share/jellyfin/web"
|
||||
},
|
||||
Windows = new
|
||||
{
|
||||
DataDir = "C:\\ProgramData\\Jellyfin\\data",
|
||||
ConfigDir = "C:\\ProgramData\\Jellyfin\\config",
|
||||
CacheDir = "D:\\Cache\\Jellyfin",
|
||||
LogDir = "C:\\ProgramData\\Jellyfin\\logs",
|
||||
TempDir = "D:\\Temp\\Jellyfin",
|
||||
WebDir = "C:\\Program Files\\Jellyfin\\web"
|
||||
},
|
||||
Portable = new
|
||||
{
|
||||
DataDir = "./data",
|
||||
ConfigDir = "./config",
|
||||
CacheDir = "./cache",
|
||||
LogDir = "./logs",
|
||||
TempDir = "./temp",
|
||||
WebDir = "./web"
|
||||
}
|
||||
DataDir = dataDir,
|
||||
ConfigDir = configDir,
|
||||
CacheDir = cacheDir,
|
||||
LogDir = logDir,
|
||||
TempDir = tempDir,
|
||||
WebDir = webDir
|
||||
}
|
||||
};
|
||||
|
||||
@@ -180,7 +200,8 @@ public static class StartupHelpers
|
||||
|
||||
File.WriteAllText(configPath, json);
|
||||
Console.WriteLine($"Created default startup configuration at: {configPath}");
|
||||
Console.WriteLine("You can customize this file to set default paths for Jellyfin.");
|
||||
Console.WriteLine($"Using {osComment}");
|
||||
Console.WriteLine("You can customize this file to set different paths for Jellyfin.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>E:\Program Files\Jellyfin-win</_PublishTargetUrl>
|
||||
<History>True|2026-02-26T18:27:30.4752489Z||;True|2026-02-26T09:50:00.8144584-05:00||;</History>
|
||||
<History>True|2026-02-26T19:18:45.2961191Z||;True|2026-02-26T14:14:22.8256393-05:00||;True|2026-02-26T13:57:14.6685421-05:00||;False|2026-02-26T13:54:54.9991818-05:00||;True|2026-02-26T13:27:30.4752489-05:00||;True|2026-02-26T09:50:00.8144584-05:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user