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.
This commit is contained in:
Patrick Farwick 2022-07-07 16:47:17 +02:00
parent c71657dfce
commit 66bac259a8
2 changed files with 48 additions and 24 deletions

View File

@ -9,7 +9,11 @@
// This is where jellyfin stores its configs, plugins, metadata etc // This is where jellyfin stores its configs, plugins, metadata etc
// This is platform specific by default, but on Windows defaults to // This is platform specific by default, but on Windows defaults to
// ${env:LOCALAPPDATA}/jellyfin // ${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 // The name of the plugin
"pluginName": "Jellyfin.Plugin.Template", "pluginName": "Jellyfin.Plugin.Template",
} }

28
.vscode/tasks.json vendored
View File

@ -7,7 +7,11 @@
// jellyfin server's plugin directory // jellyfin server's plugin directory
"label": "build-and-copy", "label": "build-and-copy",
"dependsOrder": "sequence", "dependsOrder": "sequence",
"dependsOn": ["build", "make-plugin-dir", "copy-dll"] "dependsOn": [
"build",
"make-plugin-dir",
"copy-dll"
]
}, },
{ {
// Build the plugin // Build the plugin
@ -31,12 +35,20 @@
"label": "make-plugin-dir", "label": "make-plugin-dir",
"type": "shell", "type": "shell",
"command": "mkdir", "command": "mkdir",
"windows": {
"args": [ "args": [
"-Force", "-Force",
"-Path", "-Path",
"${config:jellyfinDataDir}/plugins/${config:pluginName}/" "${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/"
] ]
}, },
"linux": {
"args": [
"-p",
"${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/"
]
}
},
{ {
// Copy the plugin dll to the jellyfin plugin install path // Copy the plugin dll to the jellyfin plugin install path
// This command copies every .dll from the build directory to the plugin dir // This command copies every .dll from the build directory to the plugin dir
@ -45,11 +57,19 @@
"label": "copy-dll", "label": "copy-dll",
"type": "shell", "type": "shell",
"command": "cp", "command": "cp",
"windows": {
"args": [ "args": [
"./${config:pluginName}/bin/Debug/net6.0/publish/*", "./${config:pluginName}/bin/Debug/net6.0/publish/*",
"${config:jellyfinDataDir}/plugins/${config:pluginName}/" "${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/"
] ]
},
"linux": {
"args": [
"-r",
"./${config:pluginName}/bin/Debug/net6.0/publish/*",
"${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/"
]
}
}, },
] ]
} }