Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ or from [Coder's Github Release page](https://github.com/coder/coder-jetbrains-t

The next step is to copy the zip content to one of the following locations, depending on your OS:

* Windows: `%LocalAppData%/JetBrains/Toolbox/plugins/com.coder.toolbox`
* Windows: `%LocalAppData%/JetBrains/Toolbox/cache/plugins/com.coder.toolbox`
* macOS: `~/Library/Caches/JetBrains/Toolbox/plugins/com.coder.toolbox`
* Linux: `~/.local/share/JetBrains/Toolbox/plugins/com.coder.toolbox`

Expand Down
29 changes: 21 additions & 8 deletions buildSrc/src/main/kotlin/PluginUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,29 @@ import kotlin.io.path.div
* Resolves the Toolbox plugin install directory for the current OS.
*/
fun getPluginInstallDir(extensionId: String): Path {
val userHome = System.getProperty("user.home").let { Path.of(it) }
val pluginsDir = when (OS.current()) {
OS.WINDOWS -> System.getenv("LOCALAPPDATA")?.let { Path.of(it) } ?: (userHome / "AppData" / "Local")
// currently this is the location that TBA uses on Linux
OS.LINUX -> System.getenv("XDG_DATA_HOME")?.let { Path.of(it) } ?: (userHome / ".local" / "share")
OS.MAC -> userHome / "Library" / "Caches"
val userHome = Path.of(System.getProperty("user.home"))
val toolboxDir = when (OS.current()) {
OS.WINDOWS -> {
val localAppData = System.getenv("LOCALAPPDATA")
?.takeIf { it.isNotBlank() }
?.let { Path.of(it) }
?: (userHome / "AppData" / "Local")
localAppData / "JetBrains" / "Toolbox" / "cache"
}

OS.LINUX -> {
val dataHome = System.getenv("XDG_DATA_HOME")
?.takeIf { it.isNotBlank() }
?.let { Path.of(it) }
?: (userHome / ".local" / "share")
dataHome / "JetBrains" / "Toolbox"
}

OS.MAC -> userHome / "Library" / "Caches" / "JetBrains" / "Toolbox"
else -> error("Unknown os")
} / "JetBrains" / "Toolbox" / "plugins"
}

return pluginsDir / extensionId
return toolboxDir / "plugins" / extensionId
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/com/coder/toolbox/feed/IdeFeedManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import kotlin.jvm.optionals.getOrNull
* This manager handles fetching IDE information from JetBrains data services,
* caching the results locally, and supporting offline mode.
*
* Cache files are stored in platform-specific locations:
* - macOS: ~/Library/Application Support/JetBrains/Toolbox/plugins/com.coder.toolbox/
* - Linux: ~/.local/share/JetBrains/Toolbox/plugins/com.coder.toolbox/
* - Windows: %LOCALAPPDATA%/JetBrains/Toolbox/plugins/com.coder.toolbox/
* Cache files are stored in the Coder Toolbox data directory:
* - macOS: ~/Library/Application Support/coder-toolbox/
* - Linux: ${XDG_DATA_HOME:-~/.local/share}/coder-toolbox/
* - Windows: %LOCALAPPDATA%/coder-toolbox/
*/
class IdeFeedManager(
private val context: CoderToolboxContext,
Expand Down
Loading