From 66bac259a81019ac2f481a7c5ba495e80e00c48c Mon Sep 17 00:00:00 2001 From: Patrick Farwick <9168045+MinecraftPlaye@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:47:17 +0200 Subject: [PATCH 1/2] Add linux support for vscode dev-setup The ${env:XDG_DATA_HOME} variable is not used, as this variable resolves to the current working directory within Visual Studio Code's development container. By manually specifying the file path, it is possible to use Visual Studio Code's development container. The "mkdir" command uses the "-p" flag. This flag creates the parent directories, as well. Should they already exists, the command moves down to the next folder to create without throwing an error. The "-r" parameter of the "cp" is required to recursively copy all files and directories within the "publish" directory. --- .vscode/settings.json | 14 +++++++---- .vscode/tasks.json | 58 +++++++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b4c529b..7fa6075 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,15 +1,19 @@ { // jellyfinDir : The directory of the cloned jellyfin server project // This needs to be built once before it can be used - "jellyfinDir" : "${workspaceFolder}/../jellyfin/Jellyfin.Server", + "jellyfinDir": "${workspaceFolder}/../jellyfin/Jellyfin.Server", // jellyfinWebDir : The directory of the cloned jellyfin-web project // This needs to be built once before it can be used - "jellyfinWebDir" : "${workspaceFolder}/../jellyfin-web", + "jellyfinWebDir": "${workspaceFolder}/../jellyfin-web", // jellyfinDataDir : the root data directory for a running jellyfin instance // This is where jellyfin stores its configs, plugins, metadata etc // This is platform specific by default, but on Windows defaults to // ${env:LOCALAPPDATA}/jellyfin - "jellyfinDataDir" : "${env:LOCALAPPDATA}/jellyfin", + // and on Linux, it defaults to + // ${env:XDG_DATA_HOME}/jellyfin + // However ${env:XDG_DATA_HOME} does not work in Visual Studio Code's development container! + "jellyfinWindowsDataDir": "${env:LOCALAPPDATA}/jellyfin", + "jellyfinLinuxDataDir": "$HOME/.local/share/jellyfin", // The name of the plugin - "pluginName" : "Jellyfin.Plugin.Template", -} + "pluginName": "Jellyfin.Plugin.Template", +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index cd2f73f..bff56d1 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,7 +7,11 @@ // jellyfin server's plugin directory "label": "build-and-copy", "dependsOrder": "sequence", - "dependsOn": ["build", "make-plugin-dir", "copy-dll"] + "dependsOn": [ + "build", + "make-plugin-dir", + "copy-dll" + ] }, { // Build the plugin @@ -27,29 +31,45 @@ "problemMatcher": "$msCompile" }, { - // Ensure the plugin directory exists before trying to use it - "label": "make-plugin-dir", - "type": "shell", - "command": "mkdir", + // Ensure the plugin directory exists before trying to use it + "label": "make-plugin-dir", + "type": "shell", + "command": "mkdir", + "windows": { "args": [ - "-Force", - "-Path", - "${config:jellyfinDataDir}/plugins/${config:pluginName}/" + "-Force", + "-Path", + "${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/" ] + }, + "linux": { + "args": [ + "-p", + "${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/" + ] + } }, { - // Copy the plugin dll to the jellyfin plugin install path - // This command copies every .dll from the build directory to the plugin dir - // Usually, you probablly only need ${config:pluginName}.dll - // But some plugins may bundle extra requirements - "label": "copy-dll", - "type": "shell", - "command": "cp", + // Copy the plugin dll to the jellyfin plugin install path + // This command copies every .dll from the build directory to the plugin dir + // Usually, you probablly only need ${config:pluginName}.dll + // But some plugins may bundle extra requirements + "label": "copy-dll", + "type": "shell", + "command": "cp", + "windows": { "args": [ - "./${config:pluginName}/bin/Debug/net6.0/publish/*", - "${config:jellyfinDataDir}/plugins/${config:pluginName}/" + "./${config:pluginName}/bin/Debug/net6.0/publish/*", + "${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/" ] - + }, + "linux": { + "args": [ + "-r", + "./${config:pluginName}/bin/Debug/net6.0/publish/*", + "${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/" + ] + } }, ] -} +} \ No newline at end of file From 4de36a8abc5bccf77d7b7b26a8022fcb6320993a Mon Sep 17 00:00:00 2001 From: Patrick Farwick <9168045+MinecraftPlaye@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:48:24 +0200 Subject: [PATCH 2/2] Add required extensions to Visual Studio Code --- .vscode/extensions.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..698bc34 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "ms-dotnettools.csharp", + "editorconfig.editorconfig" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} \ No newline at end of file